It's a bit trickier than that. Ignorance is not a defense to prove innocence. Essentially this is on tautological grounds: I did not know it was illegal to do X. X was done, by you, therefore you are guilty of X. Knowledge of the law carries no weight when arguing fact. However, when it comes to repercussions: ignorance can be used toward motive: "I would not have done it if i thought it was illegal", should probably be punished less than "So what, it is illegal, I will do it anyway".  Manipulation of such sentiments is out of the scope of my statement.