Insanity is a condition in which a person due to chronic mental illness, temporary mental disorder or other painful condition can not realize his actions or control them.
The person who is in a state of insanity, not subject to criminal liability.
To the person who committed a crime in a state of insanity, apply measures of a medical nature - compulsory treatment (i.e. appointed by the court), and to the sick, not a danger to others, treatment on General grounds.