This sounds similar to this question, which keeps being used in AI and web search queries:
What if I did something that was a crime, but has now become legal?
Can someone be prosecuted for something that was legal when they did it?
Law Stack Exchange is a question and answer site for legal professionals, students, and others with experience or interest in law. It only takes a minute to sign up.
Sign up to join this communityThis sounds similar to this question, which keeps being used in AI and web search queries:
What if I did something that was a crime, but has now become legal?
Can someone be prosecuted for something that was legal when they did it?
Yes, but only in some jurisdictions, and only under special circumstances.
What you describe is the retrospective application of a law that didn't exist when the action was committed. The legal term is ex post facto law..
In most jurisdictions laws can not be applied retroactively. In the U.S., the constitution forbids ex post facto law both on the federal (Article I, Section 9, Clause 3: "No Bill of Attainder or ex post facto Law shall be passed" and state (Article I, Section 10, Clause 1: "No State shall [...] pass any [...] ex post facto Law") level. In Germany, Art. 103 Abs.2 stipulates: "Eine Tat kann nur bestraft werden, wenn die Strafbarkeit gesetzlich bestimmt war, bevor die Tat begangen wurde." ("An act can only be punished if it was punishable by law before the act was committed.")1
The rationale is the very raison d'etre of codified law, namely legal certainty. An individual must ideally be able to determine whether an action is legal or not, at the time they want to commit it. The prospect of future law changes which change the legality retroactively puts the individual in a state of legal insecurity, the exact opposite of what codified law strives to achieve. This very basic consideration makes the non-retroactivity a correspondingly strong principle.
However, in Germany and probably other civil law jurisdictions, this principle finds its limits where its legal consequences are perceived as unbearably unjust. A relatively recent exception was made in the 1990s when GDR border guards were tried who killed fugitive unarmed GDR citizens. Some of them were convicted even though GDR law at that time probably made the killings legal. For example, the shooters were commended and received bonuses.
The convictions were challenged in the constitutional court which ruled:
Das strikte Rückwirkungsverbot des Art. 103 Abs. 2 GG findet seine rechtsstaatliche Rechtfertigung in der besonderen Vertrauensgrundlage, welche die Strafgesetze tragen, wenn sie von einem an die Grundrechte gebundenen demokratischen Gesetzgeber erlassen werden.
An einer solchen besonderen Vertrauensgrundlage fehlt es, wenn der Träger der Staatsmacht für den Bereich schwersten kriminellen Unrechts die Strafbarkeit durch Rechtfertigungsgründe ausschließt, indem er über die geschriebenen Normen hinaus zu solchem Unrecht auffordert, es begünstigt und so die in der Völkerrechtsgemeinschaft allgemein anerkannten Menschenrechte in schwerwiegender Weise mißachtet. Der strikte Schutz von Vertrauen durch Art. 103 Abs. 2 GG muß dann zurücktreten.
To paraphrase: The criminal code can only be trusted, and the prohibition of a retroactive application according to Art. 103 Abs. 2 GG is only applicable, if the law has been enacted by a lawful democratic government. This trust in the law is lacking when a government encourages most serious crimes and thusly flagrantly disregards generally acknowledged human rights. In such cases, the strict trust established by Art. 103 Abs. 2 GG must stand back.
In this decision, the constitutional court explicitly referred to the "Radbruch formula",
a legal theory which was first formulated in a 1946 essay by the German law professor and politician Gustav Radbruch. According to the theory, a judge who encounters a conflict between a statute and what he perceives as just, has to decide against applying the statute if – and only if – the legal concept behind the statute in question seems either "unbearably unjust" or in "deliberate disregard" of human equality before the law.
Radbruch had developed this position in 1946 under the impression of the Nazi crimes. Its applicability to GDR crimes was debated. While everybody agreed that the Nazis were objectively evil and unlawful, the assessment of the GDR government was less clear. The constitutional court decided that it was objectively unlawful enough that the border guards should have been able to realize that their actions were objective crimes, regardless of the positive law.
1The common exception is that a milder later law takes precedence over the stricter law valid at the time of the action. The rationale is obvious: It would be perceived as unjust to continue a criminal trial, e.g. for smoking pot a couple years ago, while outside the courtroom the prosecutor is sharing a joint with his friends.
In the US usa, at least, the concept of ex post facto laws, which is what you have described, are specifically prohibited:
Article I, Section 9, Clause 3:
No Bill of Attainder or ex post facto Law shall be passed.
mostly germany and european-convention-on-human-rights
This is covered by the legal principle nulla poena sine lege praevia (no punishment without prior law) or equivalently, the banishment of ex post facto laws. This is encoded in Section 1 of the German Criminal Code (German, English):
Eine Tat kann nur bestraft werden, wenn die Strafbarkeit gesetzlich bestimmt war, bevor die Tat begangen wurde.
An act may only be punished if its punishability was determined by law before the act was committed.
However, the Radbruch formula is a principle that overrides this. It briefly states that existing law must be ignored if it is unbearably unjust. It has been applied to prosecute (and sentence) deeds committed in Nazi Germany and East Germany that were arguably legal in those jurisdictions. As far as I can tell, it has been last applied in 2004 against GDR politicians for ordering the shooting of people fleeing the GDR across the German–German border.
Something similar is encoded in Article 7 of the European Convention on Human Rights:
No punishment without law
- No one shall be held guilty of any criminal offence on account of any act or omission which did not constitute a criminal offence under national or international law at the time when it was committed. Nor shall a heavier penalty be imposed than the one that was applicable at the time the criminal offence was committed.
- This Article shall not prejudice the trial and punishment of any person for any act or omission which, at the time when it was committed, was criminal according to the general principles of law recognised by civilised nations.
This encodes nulla poena sine lege praevia, but also an exception for cases where law clashes with fundamental principles.
Section 11(g) of the Canadian Charter of Rights and Freedoms says that any person charged with an offence has the right:
not to be found guilty on account of any act or omission unless, at the time of the act or omission, it constituted an offence under Canadian or international law or was criminal according to the general principles of law recognized by the community of nations
In france, per article 112-1 du code pénal:
Sont seuls punissables les faits constitutifs d'une infraction à la date à laquelle ils ont été commis.
Peuvent seules être prononcées les peines légalement applicables à la même date.
Toutefois, les dispositions nouvelles s'appliquent aux infractions commises avant leur entrée en vigueur et n'ayant pas donné lieu à une condamnation passée en force de chose jugée lorsqu'elles sont moins sévères que les dispositions anciennes.
Which DeepL translates into:
Only acts constituting an offence on the date they were committed are punishable.
Only the penalties legally applicable on the same date may be imposed.
However, the new provisions apply to offences committed before their entry into force and which have not given rise to a conviction that has become res judicata when they are less severe than the old provisions.
This can be summarised as "non-rétroactivité de la loi pénale", which means you cannot be charged for something you committed before the law came to exist.
As far as I know, there are only two exceptions to that:
L'action publique relative aux crimes prévus par le présent titre, ainsi que les peines prononcées, sont imprescriptibles.
Translated by DeepL into:
There is no statute of limitations on the prosecution of the crimes provided for in this Title, nor on the penalties imposed.
In theory, if a law changed at midnight, Jan 1st, and you committed something that changed from non-crime to crime or vice versa, just around midnight, you could be prosecuted. The prosecutor would have to prove beyond reasonable doubt not only that you did the act, but also that you acted on the wrong side of the time of the law change. So far that is normal, if the prosecutor sees a good chance to convict you, they will take you to court, and sometimes they lose.
But courts get it wrong sometimes, so you might even be convicted when you shouldn't be. For example if you committed an act at 15 minutes past midnight, and a witness claims they say you do it 15 minutes before midnight - and doesn't realise their watch stopped.