However, we have to be careful about what we mean by 'penal law' -- penal law is taken to include the prohibitions of international criminal law, not only those of domestic law. Thus prosecutions have been possible of such individuals as Nazi war criminals and officials of the German Democratic Republic responsible for the Berlin Wall, even though their deeds may have been allowed or even ordered by domestic law. Also, courts when dealing with such cases will tend to look to the letter of the law at the time, even in regimes where the law as it was written was generally disregarded in practice by its own authors.
This principle is enshrined in several national constitutions, and a number of international instruments. See e.g. European Convention on Human Rights, article 7(1); Rome Statute of the International Criminal Court, articles 22 and 23 (see http://cs.anu.edu.au/~James.Popple/publications/articles/retroactive/2)
For discussion of these issues, see STRELETZ, KESSLER AND KRENZ v. GERMANY (European Court of Human Rights) and K.H.-W. v. GERMANY (European Court of Human Rights).
The maxim itself is sometimes rendered: