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?

  • 3
    The nazi war crimes come to mind, I'm not sure they were strictly illegal at the time. Commented Mar 18, 2023 at 17:40
  • 2
    @MarkRogers - en.wikipedia.org/wiki/Ex_post_facto_law
    – Richard
    Commented Mar 18, 2023 at 18:06
  • @MarkRogers en.wikipedia.org/wiki/Crimes_against_humanity
    – Clockwork
    Commented Mar 18, 2023 at 19:47
  • Whilst not used in recent times, it is still likely constitutional in england to pass bills of attainder en.wikipedia.org/wiki/Bill_of_attainder, which declare that a specific act is illegal after the fact. Commented Mar 19, 2023 at 15:26
  • 1
    @MarkRogers Those were special circumstances. Foreign powers won a war, vanquished their opponents, and were in complete control over the country, being able to do whatever they wanted. It was a completely different government which prosecuted these cases, than the one under which the accused did the things they were under trial for. On the other hand, the assumption behind the question is that the jurisdiction stays the same, and the only difference is that a new law is passed which makes something no longer legal (instead of the suspects being tried by a completely different government).
    – vsz
    Commented Mar 20, 2023 at 5:20

6 Answers 6


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:

  1. 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.

  2. 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.

  • 2
    in some way, Radbruch did formulate the essence of Art. 1 GG: Human dignity shall be inviolable. To respect and protect it shall be the duty of all state authority. before the people met to draft it.
    – Trish
    Commented Mar 18, 2023 at 9:58
  • 2
    The GDR example is one of many: whenever there is a revolution or a big change in government, people tend to be judged for the acts they committed prior to the change.
    – Stef
    Commented Mar 18, 2023 at 10:31
  • 3
    @Stef But rarely does the new government try to adhere as scrupulously to legal standards as in the Nuremberg trials and the GDR trials. Commented Mar 18, 2023 at 11:08
  • 1
    Wasn't the official opinion in Western Germany that the territory and population of the GDR are actually part of Germany, but not under (Western) German control? The GDR was never really acknowledged as a foreign country. So one could argue that the Grundgesetz was already law in the whole of Germany, it was just impossible to enforce it in Eastern Germany. Commented Mar 18, 2023 at 19:30
  • 1
    @JFabianMeier That stance was abandoned several years before the reunification.
    – Trish
    Commented Mar 19, 2023 at 12:49

In the US , 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 and

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

  1. 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.
  2. 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

  • However, s.11 section can be overridden under s.33.
    – Brian
    Commented Mar 26, 2023 at 21:49

In , 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:

  • If you were in the process of being prosecuted for something which was already forbidden and a new law decreed a reduced sentence, you shall benefit from it. Example: if you were to be condemned to death sentence, and a new law abolished it, then you will no longer be sentenced to death.
  • Crimes against humanity is a notion that came to existence only after the events of World War II. Even so, you can be prosecuted for crimes you committed even before the laws existed, per article 213-5 du code pénal:

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.

  • 1
    Your second paragraph just states that miscarriages of justice happen?
    – gerrit
    Commented Mar 20, 2023 at 9:43
  • 1
    Yes. But it answers the question, and it would be the rare case that yes, you did what you were accused of, but not exactly at the right time. Normally “miscarriage of justice” means you didn’t do what you were accused of.
    – gnasher729
    Commented Mar 20, 2023 at 12:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .