Ex post facto laws retroactively change the legal consequences of actions that were committed before the enactment of the law. These laws violate a fundamental principle of criminal justice by punishing individuals or increasing punishment for acts that were not illegal at the time they were committed.