A crime is a violation of the criminal law as defined in the state or federal code. In Virginia a crime used to be defined by the "common law" handed down from England and the law in most of the American Colonies. However today it has been mostly codified by the legislature. The state code defines what a crime is and the "elements" of the crime. If you perform an action that violates the act as defined by that section of the code you have committed a crime. This is usually true even if you did not know it was a crime at the time you performed the act. See also General Criminal Law : All States