“Key, you scoundrel, you have dishonored my house—you must die!” shouted United States Congressman Daniel Sickles on February 27, 1859, as he shot Philip Barton Key, U.S. attorney and son of the author of the “Star-Spangled Banner,” with three different pistols in broad daylight in direct view of the White House.

A few days earlier, Sickles had received an anonymous letter. He’d heard whispers of a yearlong affair between his friend, Key, and his considerably younger wife, Teresa, but the letter described it in detail. It pointed Sickles to an address on Fifteenth Street where neighbors had noticed a man who did not reside there frequently tying a string or ribbon on the door. Sickles sent a trusted friend to the address and he witnessed a woman fitting Teresa’s description entering through the rear door, and a man resembling Key entering through the front. They would stay about an hour. Key was a widower whose appetite for gambling, horses, and women was well-known. It was later revealed he would watch the house from a club across the street. With his opera glasses, he would wait for Teresa to appear in the second-floor window, ready for him to join her.

As Key lay dying on the ground, Sickles snatched up those same opera glasses and delivered himself to the attorney general’s office, where he confessed. He stopped by his house on the way to jail and emerged with his wife’s wedding band, which she had accepted at just sixteen years old, and the diamond earrings he had given her on their wedding night. Daniel Sickles would hardly be the first person to commit a crime of passion, but for his very public act of murder he would become a unique legal case—the first American to successfully plead temporary insanity as his defense.

The congressman quickly became the charismatic center of a sensational trial. President James Buchanan would send a letter of support to the prisoner, and the many members of the House and Senate who visited him found Sickles not behind bars but instead holding forth in the head jailer’s quarters, his dog by his side. The congressman spoke with abandon to journalists, who reprinted his courtroom testimony and personal commentary word-for-word. Teresa visited often, as did her clergyman, who implored Sickles to return her wedding ring. He eventually acquiesced—his twenty-two-year-old wife could have the ring, but not his forgiveness.

The court of public opinion, however, was quick to forgive Sickles. “The public of the United States will justify him in killing the man who dishonored his bed,” mused an editorial in the March 12 issue of Harper’s. This wasn’t England, where the cuckolded husband might sue, but America, where murdering his wife’s lover was considered “the most natural revenge.” The New York Times agreed, and criticized its nemesis, the New-York Daily Tribune, for condemning the killing. No one believed a jury would, or should, find Sickles guilty of first-degree murder.

The trial began on Monday, April 4, 1859. One of Sickles seven defense attorneys, John Graham, gave an opening statement that lasted for two days, rewarding the public’s support of his client with unprecedented courtroom drama. He meticulously laid out the evils of adultery, quoting Shakespeare’s Othello on the agony of discovering the (supposed) infidelity of one’s wife. Graham made a clear distinction between murder, which is committed with malice aforethought, and manslaughter, which is committed in “a state of heat…the heat of passion that ought to be, but is not, controlled.” Uncontrollable passion, therefore, failed to “place a man within the pale of accountability to the criminal law.” He pressed again and again on the mental condition of the defendant (“Is it no matter how a man becomes insane; is he insane, this is the question?) and the moral heinousness of the crime. The court had to adjourn and return the next day to hear his conclusion:

It may be tragical to shed human blood; but I will always maintain that there is no tragedy about slaying the adulterer; his crime takes away the catcher of the occurrence….the fact is now proved in this case that Philip Barton Key seduced the wife of Daniel E. Sickles, and that for that, in a transport of frenzy, Daniel E. Sickles sent him to his long account.

A version of the insanity plea had found contemporary success in the English court system—a 1724 case, in which a British lord was wounded in a murder attempt, established that in order to be exempted from justice, the defendant must be “totally deprived of his understanding and memory, and doth not know what he is doing, no more than an infant, a brute, or a wild beast.”

But in the United States, it had never succeeded as a defense for the charge of murder. If the plea meant Sickles would walk out of the courtroom a free man, spectators were ready to accept it. After all, Key’s death wasn’t really Sickles’ fault—immorality begets immorality. In his closing arguments, another defense attorney, James T. Brady, argued that Sickles was “the avenger of the invaded household,” driven to madness by a public scandal. He declared the congressman’s murderous act “justifiable homicide” committed during a “temporary state of insanity.” He cast the murder not as the work of a “wild beast” but as self-defense against dishonor:

It is claimed that a man is not permitted by law to do anything for the protection and vindication of his honor…he can have the relations between him and his wife made valueless to him by the ruthless hand of the adulterer; he can have his name made a byword and a reproach; and he can have his wife reduced to a thing of shame—and cannot raise his hand to prevent all this. He can have what more?

Brady claimed that the law as it stood had failed Sickles and he shouldn’t be punished for that failure. A higher power would surely agree, he continued. “We know that the Creator did not intend that homicide should be entirely excluded from the hand of man.” Brady repeatedly invoked the commandments of the Bible: “None of us have forgotten the great command of our maker ‘Thou shall not kill’ any more than we have forgotten that other command ‘Thou shalt not commit adultery.’”

District Attorney Robert Ould told a different story: the defendant “had come to that carnival of blood fully prepared.” The prosecution relied on a far more traditional tack, arguing that premeditation stood in stark contrast to the defense’s claim of temporary insanity. Sickles didn’t display any erratic behavior when he received the anonymous letter. Indeed, he’d discussed his intent to seek retribution with a friend, who would also witness the murder from mere feet away. The district attorney also wondered why Sickles, upon spotting Key so very close to his own home on a warm day, thought to put on a heavy overcoat, and put multiple pistols in its many pockets. It seemed a little too convenient that “[Sickles] was a walking magazine [of firearms].”

But the prosecutor’s words were no match for Sickles’ own courtroom theatrics. Taking the stand, Robert J. Walker, who had been President James K. Polk’s secretary of the treasury, described his old friend on the day of the murder as emitting “an agony of unnatural and unearthly sounds,” fearing “if it lasted much longer he must become insane.” Halfway through Walker’s testimony, Sickles burst into tears and it took three men, including his father, to help him leave the courtroom. Harper’s described the scene as deeply affecting, “awakening strong sympathy in the breasts of all who saw him.” That included members of the jury, who shed their own tears during the spectacle.

The jurors sat through twenty days of arguments, but it took only a half hour for them to reach a verdict. (They would have come out earlier, but one man had asked for time to pray before voting.) The foreman read the words not guilty and the courtroom broke out into applause. As Sickles made his way to a hotel, the crowd formed a caravan, singing as they flanked his carriage.

The support was short lived. Sickles later told the New York Herald that he had abandoned plans to divorce Teresa, and Harper’s reported that his powerful friends were disappointed. Public opinion soon followed suit, and Sickles, back at home with Teresa, was now as much of an outcast as his wife. In July, the Herald printed an open letter from Sickles explaining that the reconciliation was just another way to maintain an honorable American home. “I can now see plainly enough in the almost universal howl of denunciation with which she is followed to my threshold, the misery and perils from which I have rescued the mother of my child.”

Sickles’ successful insanity plea lived on, both as a legal defense and in the public’s imagination, earning plenty of other names along the way, including the “Twinkie defense” and the “abuse excuse.” Perhaps no one defined it better than Mark Twain, who published three sketches in 1870 that served as a lengthy critique of the plea:

And is it not curious to note how very often it wins acquittal for the prisoner? Of late years it does not seem possible for a man to so conduct himself, before killing another man, as not to be manifestly insane. If he talks about the stars, he is insane. If he appears nervous and uneasy an hour before the killing, he is insane. If he weeps over a great grief, his friends shake their heads, and fear that he is “not right.” If, an hour after the murder, he seems ill at ease, preoccupied and excited, he is unquestionably insane. Really, what we want now, is not laws against crime, but a law against insanity. There is where the true evil lies.

More than a hundred years later, Twain’s cry was answered. When John Hinckley, Jr., was found not guilty by reason of insanity after attempting to assassinate President Ronald Regan, Congress passed the Insanity Defense Reform Act of 1984. The burden of proof shifted from the prosecution to the defense, and remains that way in the majority of states that still accept the plea. (In 1994, the Supreme Court upheld Montana’s abolition of the defense, which is also inadmissible in Idaho, Kansas, and Utah.)

Daniel Sickles finished his last term in Congress in 1860, and with the war looming, he took to the House of Representatives and declared he’d raised a full brigade and was ready to lead them to victory during the Civil War. He would quickly be promoted from brigadier general to major general, but his proclivity for controversy only continued. At Gettysburg, he defied General Meade’s orders, and he would again resist orders, this time from President Andrew Johnson, during the military command of the occupied Carolinas. (He would lose his leg to a cannonball at Gettysburg; the amputated limb is on display at the National Museum of Health and Medicine, where Sickles once visited it.) When Ulysses S. Grant became president in 1869, Sickles was appointed to be the ambassador to Spain. By that time, Teresa had died from tuberculosis, and Sickles allegedly became the deposed Queen of Spain’s paramour—perhaps the Spanish king proved to be a more understanding husband than Sickles himself.