You get arrested and you ask the officer why they’re arresting you. When they tell you, you’re shocked. You had no idea that what you did was even illegal. You didn’t mean to break the law. You were just ignorant of that law. Can you use this as a defense?
Generally speaking, no, you cannot use ignorance as a defense. You are supposed to know the laws that govern your society. You can’t claim that you simply had no idea that what you were doing was wrong, especially if it should be clear that it was an offense. This prevents people from purposely not learning the laws in order to use that as a way to plead innocence.
That said, you do need to have specific intent to be charged with certain crimes. One example is tax fraud. People make mistakes on their taxes all the time, but it’s not a criminal offense without intent. Another example is murder. In many cases, while taking a life may be illegal under almost all circumstances, the difference between manslaughter and murder will be whether or not you intended to take that life.
The issue of ignorance can raise some serious questions, though. Say you’re from a country like Australia, where the drinking age is 18. You come to the United States through a college study abroad program at 20. You then get arrested for underage drinking because you didn’t know that the drinking age was 21 and you had been legally drinking for two years at home. Does that factor in?
If you find yourself asking these types of questions, make sure you are well aware of the legal options that you have.