In a criminal prosecution, other than for perjury, or in an action on a penal statute, evidence shall not be given against the accused of any statement made by him as a witness upon a legal examination, in a criminal or civil action, unless such statement was made when examined as a witness in his own behalf.
Va. Code § 19.2-270