The phrase "insanity plea" means when someone accused of a crime claims that they are not guilty because they were mentally ill or didn't understand what they were doing. Full definition
«lawyer is going for insanity plea due to successive years of ritual beatings» (religion.blogs.cnn.com)
Doctors say Amber Lynn James suffered delusions; lawyer enters not guilty by reason of insanity plea (kitsapdailynews.com)
Police making stops, judges setting bonds and deciding to permit probation, parole boards deciding whether to release someone, psychiatrists deciding on three day holds and releases from incarceration following a successful insanity plea, etc.. (law.stackexchange.com)