A Democratic mayor from Pennsylvania has resigned nearly a month after he was arrested for allegedly soliciting a woman for sex — a woman who turned out to be a police informant.

Bloomsburg Mayor Eric Bower, 36, initially claimed the accusations were made up because of his “political position.”

He was arrested on April 20 after investigators said he showed up at a Hampton Inn with condoms and $200 in cash. According to the attorney general’s office, the woman, whom Bower solicited for sex that day, was “a Pennsylvania State Police confidential informant.”

Police said Bower met with the informant on several different occasions, with the most recent meetup resulting in his arrest.

“Bower negotiated a fee for sex with the informant and arrived at the location with cash and condoms, where he was taken into custody by police,” the attorney general’s office said in a statement.

ERIC SCHNEIDERMAN, POWERFUL NY DEMOCRAT ACCUSED OF VIOLENCE AGAINST WOMEN AND DRUG ABUSE, RESIGNS AS STATE ATTORNEY GENERAL

Four days after his arrest, Bower told WNEP that the unidentified woman was a friend — he described their relationship as “very playful, you know.”

At the time he planned to fight the charges, claiming that it was a “setup because of my political position.”

However, the Democrat, who was elected in November, announced Thursday through the attorney general’s office that he would be waiving a preliminary hearing and immediately would vacate the mayor’s office.

He also stepped down from his post as a state constable.

Attorney General Josh Shapiro said that Bower “flouted the law.”

“No one is above the law,” Shapiro said in a statement. “I will not allow individuals in power to abuse the trust the public has placed in them. I’m rooting out public corruption wherever we find it, without fear or favor.”

SCHNEIDERMAN RESIGNATION LEAVES REPLACEMENT ATTORNEY GENERAL UP TP NEW YORK LEGILATURE

But Bower’s attorney, Patrick O’Connell, said that the decision to step down was done for the good of Bloomsburg, a small town northwest of Philadelphia.

“The town of Bloomsburg needs to focus on the tasks that it needs to focus on, running an efficient local government, which is challenging enough. But these charges caused a circus environment. Eric Bower recognized that and for the better of the town, decided to resign,” O’Connell said.

Earlier reporting at the time of Bower’s arrest by WOLF cited him as saying that he planned to “hold” his position as mayor and fight the charges against him. Now that he has resigned, it remains unclear if he will continue to dispute the allegations against him.

The Associated Press contributed to this report.