Spencer with a selfie stick on Cohen’s show. (Video image/YouTube)

Georgia state Rep. Jason Spencer, who attracted nationwide ridicule after yelling obscenities and dropping his pants on Sacha Baron Cohen’s TV show, has submitted his resignation from the Georgia House of Representatives, the office of the House speaker confirmed to The Washington Post early Wednesday.

Spencer’s notice of resignation comes after he appeared on a July 22 episode of Cohen’s Showtime series, “Who Is America?,” in which Cohen dupes unwitting public figures into participating in fake interviews or activities. In Spencer’s case, Cohen disguised himself as an “anti-terror expert” and coaxed Spencer into participating in a self-defense class to protect against terrorist kidnappings.

As part of the “training,” Spencer yelled the n-word multiple times while learning how to ward off a kidnapper; offered an offensive portrayal of a “Chinese tourist” while using a selfie stick to take pictures up a Muslim actor’s robe to check for a gun, and, lastly, dropped his pants and chased Cohen around threatening to touch him with his buttocks, which he was told would “intimidate” terrorists.

“If you want to win, you show some skin,” Cohen told him just before Spencer bared his backside.

The outlandish behavior drew the ire of Georgia Speaker of the House David Ralston (R), who had urged Spencer to resign.

After initially resisting, Spencer emailed the speaker that he would resign at 11:18 p.m. Eastern time Tuesday, Ralston’s spokesman, Kaleb McMichen said.

“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 wrote in the email, the text of which was provided to The Washington Post.

McMichen said his office has forwarded Spencer’s resignation notice to the governor’s office.

Spencer could not immediately be reached for comment early Wednesday.

In a July 23 statement to The Post, Spencer said Cohen “took advantage of my paralyzing fear that my family would be attacked.” He claimed he was assured the video of his “self-defense exercises” would be used as a “ ’demonstration video’ to teach others the same skills in Israel.” He previously claimed in a statement to the Atlanta Journal-Constitution that he was told the video would be used as an “educational aid to train elected officials who may be targeted by terrorists.”

Spencer claims his fear of attack stems from death threats he received after introducing legislation in 2016 that would have banned Muslim women from wearing burqas in public. That legislation was the subject of Cohen’s first prank.

“Do you know how to spot the difference between somebody who is a terrorist in a burqa and a normal woman in a burqa?” Cohen asked.

Spencer said he didn’t. Then, at Cohen’s instruction, he stuck a selfie stick beneath the robe of a burqa-clad actor and snapped a picture. There was no gun. “It’s not a terrorist,” Cohen said.

In another exercise, Cohen assured Spencer that Islamic State terrorists are afraid of being touched by other men’s buttocks because they are afraid of becoming “homosexuals.” At Cohen’s instruction, Spencer, his buttocks exposed, proceeded to chase Cohen while yelling, “USA!”

The graphic video can be seen here.