Georgia state Rep. Jason Spencer yelled the N-word and exposed himself on comedian Sacha Baron Cohen's TV show "Who Is America?"

Cohen was pretending to be an Israeli counterterrorism expert giving Spencer what he believed was a lesson in fighting terrorists.

Spencer said in a long statement yesterday that he regretted his actions, but would stay in office until the end of his term.

Spencer will now step down at the end of the month, according to a spokesperson for the Georgia house speaker.

The Georgia lawmaker who yelled the N-word and bared his butt in an effort to turn ISIS terrorists "homosexual" on comedian Sacha Baron Cohen's new TV show is resigning at the end of the month.

Georgia representative Jason Spencer was humiliated by footage from "Who is America?", in which Cohen posed as a counterterrorism expert and taught Spencer a series of absurd self-defense techniques on camera.

Here is the video:

Kaleb McMichen, a spokesman for Georgia House Speaker David Ralston told The Atlanta Journal-Constitution on Tuesday that Spencer will step down at the end of the month.

Spencer had previously told The Washington Post: "I deeply regret the language I used," and claimed that Cohen had exploited his fear of terrorists to get him to embarrass himself.

Spencer planned to serve the remaining five months of his term, but cut that short as the backlash against his actions continued to grow.

He had already lost his primary, so there was never a possibility of his continuing in office beyond the next set of state elections.

Cohen, left, and Spencer on "Who is America?" Showtime

Spencer, a Republican, had faced calls to resign from figures including Speaker Ralston.

Ralston released a statement which said: "The actions and language used on this video are reprehensible. Representative Spencer has disgraced himself and should resign immediately. Georgia is better than this."

The segment included ridiculous advice, including distinguishing terrorists from non-terrorists by posing as a Chinese tourist and using a selfie stick to take upskirt photographs of people wearing a burqa or niqab.

In another "technique," Cohen prompted Spencer to scream the N-word to "attract attention" and save himself from being kidnapped. Spencer appeared to do this without hesitation.

Spencer tried to offer an explanation for his actions in a statement, as reported yesterday by Business Insider. He said that he was acting in response to fear for the lives of himself and his family after receiving "countless death threats" in office. You can read the full statement here.

He said that Cohen and his team took advantage of these fears and that he was uncomfortable participating but wanted to learn how to protect himself.

Business Insider has contacted David Ralston and Jason Spencer for further comment.