WASHINGTON – The Supreme Court ruled Monday that states have broad authority to define insanity in their criminal codes.

The 6-3 ruling was written by Associate Justice Elena Kagan, a liberal who sided with the court's five conservative justices. Associate Justice Stephen Breyer wrote a spirited dissent, joined by Associate Justices Ruth Bader Ginsburg and Sonia Sotomayor.

The case dealt with a quadruple murder committed by a Kansas man seeking to use an insanity defense. But the problem for James Kahler – who admitted killing his estranged wife, mother-in-law and two daughters in 2008 – was that Kansas all but abandoned that defense a decade earlier.

To win a conviction, the state needed only prove that Kahler acted with intent. The Constitution does not force acquittal of defendants who cannot tell right from wrong, the high court ruled.

More:Supreme Court, trying to remain above the partisan fray, opens 2019 term with a debate about insanity

"We ... decline to require that Kansas adopt an insanity test turning on a defendant’s ability to recognize that his crime was morally wrong," Kagan wrote. "Contrary to Kahler’s view, Kansas takes account of mental health at both trial and sentencing. It has just not adopted the particular insanity defense Kahler would like."

Only three other states – Idaho, Montana and Utah – have eliminated the insanity defense, though Kagan opined during oral argument in October that Kahler likely would not have been found insane anywhere.

Even so, she and other justices noted that throughout history, prosecutors have needed to prove more than intent to overcome mental health defenses. Briefs filed on Kahler's behalf referred to early Jewish tradition, in which "madness" excused otherwise punishable crimes, and the first pages of Genesis introduce "knowledge of good and evil."

At oral argument, Breyer said Kansas' standard would treat two defendants differently: "The first defendant thinks that Smith is a dog. The second defendant knows it's a person but thinks the dog told him to do it."

"What's the difference?" Breyer asked, rhetorically. "They are both crazy."

In his 23-page dissent, Breyer said Kansas "has not simply redefined the insanity defense. Rather, it has eliminated the core of a defense that has existed for centuries: that the defendant, due to mental illness, lacked the mental capacity necessary for his conduct to be considered morally blameworthy."