(Reuters) - A Georgia state lawmaker who yelled racial slurs and dropped his pants on a prank cable TV show after being told it would intimidate terrorists offered a terse resignation letter to the speaker of the Georgia House of Representatives late Tuesday.

Fellow Republicans had called on state Representative Jason Spencer to resign after his appearance on shock comedian Sacha Baron Cohen’s “Who is America?” where he slurred African-Americans, Middle Easterners and Asians at the urging of a character played by Cohen.

The series, in which a disguised Cohen interviews subjects who do not realize they are working with a comedian, also features a congressman supporting the idea of arming children as young as three to stop school shootings and former Vice President Dick Cheney signing a jug described as a “waterboarding kit.”

In the episode that Spencer appeared in, a disguised Cohen presented himself as an Israeli anti-terrorist expert. After airing Sunday night, the video went viral on the internet.

“This email/letter is to serve as an official resignation notice to your office that I will be resigning my post effective July 31, 2018,” Spencer said in a statement to Georgia House Speaker David Ralston, who had called for Spencer to step down.

Ralston’s office provided the statement to Reuters.

Spencer had lost a primary election and was going to leave the office, which he has held since 2010, after the November general election.

Spencer apologized in comments to the Atlanta Journal-Constitution, adding, “Sacha Baron Cohen and his associates took advantage of my paralyzing fear that my family would be attacked.”

Cohen has for years used disguises and various characters to catch celebrities, politicians and ordinary people saying offensive things.