A US state politician who exposed himself and yelled racial slurs on provocateur Sacha Baron Cohen’s new TV series will resign.

Georgia state representative Jason Spencer will step down at the end of the month, a spokesman for House Speaker David Ralston told the Atlanta Journal-Constitution.

In Cohen’s Showtime series Who Is America?, which was broadcast on Sunday, Cohen poses as an Israeli military expert who persuades Spencer to take part in several outlandish exercises.

The lawmaker is told they are making a counterterrorism video.

Spencer repeatedly shouts a racial slur for black people after Cohen tells him the tactic is useful for drawing bystanders’ attention to an unfolding attack.

He also drops his pants, then his underwear, before backing his exposed rear end toward Cohen while shouting “USA!” and “America!”

Cohen told Spencer the move would incite fear in homophobic jihadists.

The segment also shows Spencer speaking with a mock Asian accent while pretending to use a selfie-stick to surreptitiously insert a camera phone under a Muslim woman’s burqa.

Ralston and others called for his immediate resignation.

In a statement on Monday, Spencer apologised for the “ridiculously ugly episode” but he initially refused to step down.

Spencer lost the Republican primary in May but he could have remained in public office through the November election.

Spencer is not the first person to come unstuck on Cohen’s program.

Earlier this month, the comedian was successful in persuading gun-rights activist Philip Van Cleave to advocate for toddlers to be trained to use firearms.