The insanity defense is a fairly famous piece of law but it's not always well explained. Even less well-understood is how 'insanity' can affect a trial before it's even begun.
The justice system assumes that defendants understand the gravity of their actions and know, at least on some level, that what they did was wrong. Sometimes that assumption doesn't work out. In those cases, the court has to make a determination on whether to treat that defendant differently.
Insanity is a loaded term and legal insanity is not entirely the same as what psychologists include under the term 'mental illness.'
In the law, insanity is most often associated with the insanity defense. It's a well-known idea but in reality it isn't often successful.
Traditionally there were two different insanity defenses. Some state laws considered the defendant insane if their mental illness prevented them from knowing right from wrong, called the M'Naghten rule.
Others state laws looked at whether the defendant had an 'irresistable impulse' to commit the crime despite knowing it was wrong.
The second test has generally been removed from the law and most states now rely on the M'Naghten rule only.
The insanity defense refers to the defendant's mental state at the time the crime was committed. But our justice system also forbids prosecuting a defendant who is so mentally ill that they cannot understand the criminal charges or the impact of a trial and potential sentence.
When this happens, courts say the defendant is 'not competent' to stand trial.
At that point, the trial is put on hold while the defendant receives mental health treatment, generally in a secure facility. If they later become competent later a court date is scheduled.
Despite the insanity defense's place in pop culture, not many defendants actually invoke it. Those that do are not often successful.
Even if a defendant does successfully defends their actions by pleading insanity that doesn't mean they walk free. Those individuals are found 'guilty but mentally ill' and must receive psychiatric treatment during their incarceration.
In some instances they are kept in a secure mental health facility until they are able to be moved to a prison.
The legal system has to balance public safety with the interests of justice when mental illness is involved. Insanity isn't a get out of jail free card but it does have an impact on how the law is carried out.