Discuss mental state vs. criminal responsibility.
John Hinckley Jr. was found not guilty by reason of insanity for the attempted murder of President Ronald Reagan in 1981, even though it was quite obvious he committed the crime. It was videotaped, he was immediately apprehended in front of dozens of witnesses and in a sane world, that would have been an open an shut case.
In the trial, Hinckley was obviously mentally unstable and out of touch with reality, chewing on his tie during hearings and claiming he shot the President to impress the actress Jodie Foster. In such a state, he could not have been culpable for a crime when his mind was incapable of knowing it was a crime. There would be no intent to commit a crime when there was no possibility of determining in his mind what a crime was. Had he known, or been capable of knowing, then he could be held criminally responsible for the act. In this case, the defendant could not be both insane and criminally responsible too.
Depending on what crime you are talking about, it is often possible that a person cannot be guilty of a crime unless they have the "proper" mental state. This is particularly true for crimes that involve intent.
For example, the crime of first degree murder involves the idea of intent and specifically intent that was conceived of before the act. If you kill someone in the heat of the moment, you can generally not be convicted of first degree murder. This is because you do not have the proper mental state -- you did not come into the situation with a plan to kill the person who ended up dying.
Please follow the link for a longer discussion of this concept.