Ignorantia juris neminem excusat.
Ignorance of the law excuses no one.
Can ignorance of the law ever be an excuse?
The Middle Ages deliberated over this topic, ultimately drawing a distinction between two classes of people: those who had no excuse not to know the law, and those who did have an excuse for their ignorance. Canon law wanted to be strict and definitive, but it recognized that there were segments of society that could not be held completely responsible for their actions.
For whom was ignorance of the law an excuse? Actually, several groups were considered exempt from presumption of knowledge of the law:
...minors, madmen, soldiers, and, in most circumstances, women were commonly believed to lack the capacity (in the case of minors and the insane) or the opportunity (in the case of soldiers and women) to know and understand the law. [Medieval Canon Law, James Brundage, p.161]Much of medieval canon law came from Roman sources such as the Digestum Justiniani (the Digest of Justinian*) in 503. It assembled 50 books covering many topics by multiple jurists. In the Digestum, one classical jurist, Paul, draws a distinction between ignorance of the law and ignorance of fact. Although the legal system may not be able to presume that everyone knows the actual law, it must presume that everyone knows the fundamental factual difference between a good act and a bad act in their community. Otherwise, profession of one's ignorance becomes a universal excuse, and only those who are lawyers, judges, or politicians who actually make the laws would ever be able to be convicted.
Paul is also the jurist who created the basis for presumption of innocence when he wrote Ei incumbit probatio qui dicit, non qui negat. ("Proof is incumbent on him who asserts, not him who denies.") Although the accused could not avoid punishment by simply saying "I didn't know," at least he wasn't convicted based simply on another's say-so.**
*This was Emperor Justinian I (c.482-565), whose reign straddled the Classical and Medieval eras. The Digestum is not to be confused with the Corpus Juris Civilis (Body of Civil Law), the much larger compendium (sometime called the Code of Justinian) that was assembled later in his reign, of which the Digestum was only a part.
**The phrase "Innocent until proven guilty" was coined by the English lawyer Sir William Garrow in the early 19th century.