SAN DIEGO - Conan O'Brien has made peace with a man who heckled him not from the crowd but the courts.

O'Brien and several co-defendants, including his writing staff, has agreed to settle a 2015 lawsuit with California writer Robert Kaseberg, who alleged the talk-show host stole five jokes from his Twitter feed and blog for O'Brien's monologues on his T-B-S show, "Conan."

Attorneys for both sides filed documents in San Diego federal court announcing a deal had been reached about three weeks before a trial that would have seen O'Brien, his sidekick Andy Richter and other famous names called to the stand.

Terms of the deal were not disclosed.

The joke-theft case was rare from the start, and O'Brien also gave it an unusual ending, explaining why he settled at length in a column in Variety rather than opting for the confidentiality common in Hollywood lawsuits.

O'Brien insists that he and his staff had never heard of Kaseberg, his blog or his Twitter account before the lawsuit, and did not steal any jokes.

But he did not want "a farcical and expensive jury trial in federal court over five jokes that don't even make sense anymore."

"Short of murder, stealing material is the worst thing any comic can be accused of," O'Brien writes. "Had I, for one second, thought that any of my writers took material from someone else I would have fired that writer immediately, personally apologized, and made financial reparations."

Kaseberg released a statement saying he was happy with the friendly resolution.