Ignorance is not an excuse, but it can diminish the crime if the crime is defined in a way that requires intent.
For example, intent can be the difference between murder ("first degree" to Americans) and recklessly causing someone to die. If you poison someone's food and they die, it's murder. If you unwittingly poisoned the food, it's not, but you may be held accountable for a different crime (i.e. recklessness that resulted in death).
This distinction is okay. In fact I'd argue it's expected.
EDIT: Heck, if intent were irrelevant, it'd even be legal to plan to kill or harm people as long as you don't fully follow through. If you caught a terrorist before the act, you'd have to let them go because they haven't yet actually harmed anyone.