Legal impossibility is a traditional common law defense to a charge of an attempted crime.
Legal impossibility arises when the act, if completed, would not be a crime.
[1]: 707 A person believes she is committing a crime, but the act is, in fact, lawful.
The United States Model Penal Code did away with the legal impossibility defense.
[3] Under the MPC, a defendant is guilty of an attempt to commit a crime if they purposely engage in conduct which would constitute the object crime if the attendant circumstances were as they believed them to be.