An appeals court on Thursday dismissed a $95 million defamation lawsuit against comedian Sacha Baron Cohen filed by former Alabama Supreme Court Justice Roy Moore, who said he was duped into a television appearance that followed sexual misconduct allegations against of. The 2nd U.S. Circuit Court of Appeals in Manhattan, affirming a lower court’s ruling in favor of Baron Cohen, said Moore had signed a disclosure agreement barring any legal claims related to the appearance. The three judges also found it was “pure comedy” when Baron Cohen introduced a so-called pedophile detector that beeped when it approached Moore and no viewer would believe the comedian was making real allegations against Moore. The lawsuit centered on Moore’s inadvertent appearance in the comic strip “Who is America?” projection. The segment aired after Moore faced allegations of misconduct during the 2017 US Senate race in Alabama that he had sexual and romantic relationships with teenagers when he was a man in his 30s. He denied the accusations. Moore, a Republican known for his hard-line views opposing same-sex marriage and supporting the public display of the Ten Commandments, had said he was receiving an award for his support of Israel. But in the segment, Baron Cohen appeared as fake counter-terrorism instructor “Col. Erran Morad” discussing bogus military technology, including the alleged pedophile detector. The fake device beeped repeatedly as it approached Moore, who was sitting stone-faced. “Baron Cohen may have implied (despite his disclaimers of a belief that Judge Moore was a pedophile) that he believed Judge Moore’s accusers, but he did not imply any independent factual basis for that belief other than the obviously farcical detection pedophile “device,” which no reasonable person could believe to be a real, functioning piece of technology,” the court wrote in the unsigned summary judgment. Moore and his wife, Kayla, sued, claiming the department defamed Moore and caused them emotional distress. The couple claimed the waiver Moore signed was unenforceable because it was obtained under false pretenses. The appellate court noted that it was indeed a ruse that got Moore to appear on the show, but Moore signed a binding release waiving all legal claims. The allegations against Moore contributed to his loss to Democrat Doug Jones, the first Democrat to represent Alabama in the Senate in a quarter century. The seat returned to Republican control when Jones lost the next election to Sen. Tommy Tuberville, a former college football coach. Baron Cohen has been luring unwitting politicians into awkward interviews for years. He has faced previous lawsuits over similar pranks, but those were also dismissed because the people had signed pledges. Moore and his wife said they would appeal. “For too long the American people have suffered the antics of Sacha Baron Cohen. His vicious and deceitful behavior must stop. We will appeal,” the couple said in a statement sent to The Associated Press. Our Morning Update and Afternoon Update newsletters are written by Globe editors, giving you a concise summary of the day’s most important headlines. Sign up today.