Insanity
The definitions of legal insanity differ from state to state, generally a person is considered insane and is not responsible for criminal conduct if, at the time of the offense, as a result of a severe mental disease or defect, he was unable to appreciate the nature and quality or the wrongfulness of his acts. This basic reason for allowing the 'Insanity Plea' as a defense is because willful intent is an essential part of most offenses; a person who is insane is not capable of forming such intent. Mental disease or defect does not alone constitute a legal insanity defense. The defendant has the burden of proving the defense of insanity by clear and convincing evidence. (Image taken from here.)
Mental condition rendering trial impractical
If the home secretary is satisfied by the reports from at least two medical practitioners that person is suffering from mental disorder, he may order that person to be detained in hospital in public interest. (this power is exercised by The Home Secretary only) or If