The insanity defense, also known as the mental disorder defense, is an affirmative defense by excuse in a criminal case, arguing that the defendant is not responsible for their actions due to a psychiatric disease at the time of the criminal act.
Wikipedia