There is a huge difference between psychiatric and legal insanity. Israeli law exempts a person from legal responsibility if an organic mental deficiency or an illness has led to any of the following -
"cognitive" insanity - an inability to know what one does or to see the wrong in what one does;
"emotional" insanity - the inability from restraining oneself from succumbing to an urge ("dahaf lav bar kibush").
Eliahu, or someone else with access to Takdin or Pador, can supply the reference from legislation. Any volunteers?
Someone may be seriously ill and disturbed, but not to the extent of falling into these categories, and will therefore end up convicted and punished. There are cases in which mental illness can result in diminished responsibility, but for a complete exemption, one must fit in the categories stated above. Is it possible to easily determine a person's status vis a vis the requirements? Obviously not - that's why there are mental health expert comflicting testimonies.
Which kind of leads us to the question, whether such distinctions (ill/evil/criminal) are so clear in the first place (hint: they aren't), and whether they are justifiable.