(Note to downvoter(s): this is a genuine counterpoint to mens rea. You can break a criminal law with a clear conscience, yet still be convicted, when the reason you had a clear conscience is that you didn't know it was illegal. It's a fine distinction.)
Except that with the proliferation of laws in recent decades, "Ignorance of the law is no excuse" has become a sick joke. It is literally impossible for someone to know all the laws they could be breaking. See for example Harvey Silverglate's recent book, Three Felonies a Day.
I personally think this statement is pretty misunderstood. I don't think they mean "ignorance of the law is not a valid excuse" (i.e. "you should have known") but rather "if you don't know the law we're still going to punish you" (i.e. "we don't care if you could have known or not").
Mens rea has to do with the natural consequences of the act while legal mistake (not knowing the law) has to do with the legal consequences. So, eg, if I burn down your house, mens rea asks, "did I intend to cause the fire?" while legal mistake asks, "did I know it was illegal?" Generally lack of mens rea is a defense (I burned down your house by accidently starting a grease fire in the kitchen,) while legal mistake is not (I didn't know it was illegal to burn down houses.) The exception to legal mistake is when the law requires legal knowledge, eg, knowingly failing to file a tax return (I must know that the return is required.)
There is also factual mistake where the mistake is not about the law but about some fact necessary to the crime, eg I intend to link to burn down my neighbor's house but instead, mistaking my house for my neighbor's, burn down my own house.
(Note to downvoter(s): this is a genuine counterpoint to mens rea. You can break a criminal law with a clear conscience, yet still be convicted, when the reason you had a clear conscience is that you didn't know it was illegal. It's a fine distinction.)