On an indictment for felony the jury may find the accused not guilty of the felony but guilty of an attempt to commit such felony, or of being an accessory thereto; and a general verdict of not guilty, upon such indictment, shall be a bar to a subsequent prosecution for an attempt to commit such felony, or of being an accessory thereto.
Va. Code § 19.2-286