How do we define insanity?

Kelsey Patterson spent much of the 1980s in-and-out of mental hospitals in Texas. No one questioned that he had a severe mental illness –paranoid schizophrenia – that often caused him to become violent. 
In 1980, he shot and seriously wounded a co-worker. Patterson believed his food was being poisoned by the man even though they’d only met that morning.
Three years later, Patterson wounded another man during a delusional assault.
In 1986, Patterson assaulted yet a third victim.
Finally, on September 25, 1992, just days after his brother had tried unsuccessfully to get him committed to a psychiatric facility, Patterson fatally shot a businessman and his secretary.
He then put his gun down, stripped to his socks, and paced, shouting incomprehensibly until the police arrived.
There was no doubt that Patterson had committed two murders.
There was no doubt that he had a severe mental illness and was delusional at the time of the murders.
Did that mean he couldn’t be held accountable for his actions because he was legally “insane?”