A former state representative has accepted a plea deal after he told a staffer to “out” him as having gay sex in an alley in a mass email.

The bizarre scandal made headlines in Michigan when Tea Party politician Todd Courser (R) told a staffer to send a mass email to thousands of Republicans in the state accusing Courser of having gay sex in public and other scandalous behavior.

The email said that Courser was caught having “male on male paid for sex behind a prominent Lansing nightclub” and was “a bi-sexual porn addicted sex deviant” and a “Godless Addicted Monster.”

What really happened was that Courser was threatened with blackmail by the husband of Representative Cindy Gamrat (R) because Courser and Gamrat – who are both married with children – were having an affair.

In recordings with his staff that were made public, Courser said that he wanted to use a “controlled burn” strategy to save his career to “inoculate the herd” to the real accusations.

Related: Lawmaker who pretended to sleep with rentboy says “God is dead”

“It will make anything else that comes out after that — that isn’t a video — mundane, tame by comparison,” Courser said in the audio recording.

The plan was made public and Courser resigned. Gamrat was removed from office by the state house.

Courser faced numerous charges at first from then-Attorney General Bill Schuette. A judge threw some of them out, and last week pled no contest to one count of willful neglect of duty by a public officer, although he may still face a charge of perjury.

“Today’s decision by Todd Courser to plead no-contest to a one-year misdemeanor may be the wisest decision he has made in years,” said Michigan Attorney General Dana Nessel. “This case has had a long, torturous history and his decision to acknowledge responsibility for his actions is long overdue.”

Courser’s sentencing hearing is scheduled for later this month. He could receive up to one year in prison and a $1000 fine.

Courser and Gamrat were far-right Tea Party politicians who frequently battled with the Republican establishment in Michigan. The two once wrote a “liberty response” to the Republican governor’s State of the State address, something that usually only the opposing party does.

Before the affair was made public, Gamrat had already been voted out of the state Republican caucus for leaking confidential discussions with Republicans.

Gamrat and Courser combined their operations in the state house in what The Detroit News called “an unusual arrangement.” Their staffers effectively worked for both of them.

“Everything in the office was done and intertwined around their relationship — from time management to who’s going to get what bills,” said former aide Joshua Cline, who confronted the two state reps for their “unprofessional” behavior in the office.

After Gamrat was kicked out and Courser resigned from the state house, they tried to get elected back to their offices. They both lost.