Former U.S. Senate candidate Roy Moore is the latest person to face a prank by comedian Sacha Baron Cohen.

Moore appeared on Cohen's Showtime series "Who Is America?" Sunday night. After failing what Cohen's character called a pedophile detector test, Moore walked off the fake interview set.

Moore, a Republican, lost a special election for U.S. senate last year to Democrat Doug Jones. Several women made accusations during the campaign that Moore had made unwanted romantic or sexual advances towards them throughout his career, including one woman who said she was 14 years old when the former Alabama Chief Justice approached her.

Cohen posed as an Israeli anti-terrorism expert Col. Erran Morad, who was interviewing Moore when he mentioned a new piece of technology-- a device that detects a hormone from pedophile's sweat.

"Sex offenders and particularly pedophiles secrete an enzyme for DDHT, which is actually detectable," Cohen's character told Moore. "In Israel they've developed a machine that is used in schools to detect anyone coming in and if they detect the pedophile it alerts the law enforcement."

Cohen took out the supposed device, and waved it in front of himself. The machine didn't alert.

Then, Cohen waved the device in front of Moore-- and it beeped. "Obviously a problem, must be faulty - malfunctioning," Cohen said.

Cohen also waved the machine in front of another man on the set, and the device stayed silent.

Again, it beeped in front of Moore.

"I've been married for 33 years, I've never had an accusation of such things," Moore said. "If this is an instrument, then it's certainly... I'm not a pedophile, okay? Maybe Israeli technology hasn't developed properly."

Moore walked off the interview set, saying he was "cutting this conversation." He said, "I support Israel, I don't support this kind of stuff."

In a statement sent out before the episode aired, Moore threatened legal action against Cohen and criticized its satire of American values.

"I am involved in several court cases presently to defend my honor and character against vicious false political attacks by liberals like Cohen," Moore said. "If Showtime airs a defamatory attack on my character, I may very well be involved in another. As for Mr. Cohen, whose art is trickery, deception, and dishonesty, Alabama does not respect cowards who exhibit such traits! It's been a long time since I fought for my country in Vietnam. I'm ready to defend her again!"