A $95 million defamation lawsuit against comedian Sacha Baron Cohen was rejected by an appeals court, which was previously filed by former Alabama Supreme Court Chief Justice Roy Moore, who said he was tricked into a television appearance that lampooned sexual misconduct accusations against him.

WATCH ROY MOORE’S INTERVIEW about being targeted by the comedian:

Upholding a lower court’s ruling in favor of Baron Cohen, the 2nd U.S. Circuit Court of Appeals in Manhattan, said Moore signed a disclosure agreement that prohibited any legal claims over the appearance.

It was “clearly comedy” when Baron Cohen demonstrated a so-called pedophile detector that beeped when it got near Moore and no viewer would think the comedian was making factual allegations against Moore, the three judges also found.

Moore’s unwitting appearance on the comic’s “Who is America?” show is where the lawsuit was centered on. The segment ran after Moore faced misconduct accusations during Alabama’s 2017 U.S. Senate race that he had pursued sexual and romantic relationships with teens when he was a man in his 30s, which he denied, per a report.

Moore is a Republican known for his hardline stances opposing same-sex marriage and supporting the public display of the Ten Commandments.

He had been told he was receiving an award for supporting Israel, But in the segment, Baron Cohen appeared as faux counterterrorism instructor “Col. Erran Morad” discussing bogus military technology, including the supposed pedophile detector. Repeatedly, the fake device beeped as it got near Moore, who sat stone-faced.

The court wrote in the unsigned summary order: “Baron Cohen may have implied (despite his in character disclaimers of any belief that Judge Moore was a pedophile) that he believed Judge Moore’s accusers, but he did not imply the existence of any independent factual basis for that belief besides the obviously farcical pedophile detecting ‘device,’ which no reasonable person could believe to be an actual, functioning piece of technology.”

Arguing that the segment defamed Moore and caused them emotional distress, Moore and his wife, Kayla, sued. The waiver Moore signed was unenforceable because it was obtained under a false representation, the couple claimed. It was indeed a ruse that got Moore to appear on the show but Moore signed a binding release waiving all legal claims, the appellate court noted.

The accusations against Moore contributed to his loss to the first Democrat to represent Alabama in the Senate in a quarter-century, Doug Jones. But when Jones lost the following election to Sen. Tommy Tuberville, a former college football coach, the seat returned to Republican control.

Baron Cohen lured unwitting politicians into awkward interviews for four years, and he has faced past lawsuits over similar pranks, but those were also tossed out because the individuals had signed releases.

Moore and his wife indicated they will appeal.

The couple said in a statement: “For far too long the American people have been subjected to the antics of Sasha Baron Cohen. His pusillanimous and fraudulent conduct must be stopped. We will appeal.”