The prosecution must prove not only facts, but also a state of mind. it's called mens rea. The accused person must have had criminal intention, or at least a degree of carelessness about what may happen. Sometimes intention is presumed, but the defence may disprove it. Insanity is such a defence, but so is compulsion, or honest mistake, or contrary intention.
Criminal lawyers say that every man (and the occasional woman) is entitled to his defence; but at risk of what confusion - it's actually an invitation to untruth. If I am asked to plead - and I say "not guilty" - what does it mean? 1 - I didn't do it; 2 - I did it, but you prove it, and I'm a liar anyway, or 3 - I did it but I am not a criminal.
You may ask cynically - who expects to hear the truth in a court of law? Who on earth can know or believe the truth?
John Tripe is principal with legal firm of Jack Riddet Tripe.