An Anoka man admitted in court Monday to angrily posting nude pictures of his ex on a fake Facebook account after their relationship ended and she began seeing someone else.

Michael Weigel, 39, pleaded guilty in Ramsey County District Court to one count of nonconsensual dissemination of private sexual images after reaching a plea deal in his case with prosecutors, court records say.

Weigel was the first person charged in Ramsey County under a new state law that took effect late last summer that seeks to hold people accountable for so called “revenge porn.”

Weigel created a fake Facebook page under his ex’s new boyfriend’s name during the winter of 2016 and then sent friend requests to several people, including the woman’s family and friends. Then he posted about 20 semi-nude and nude photos of his ex on the wall of the social networking site.

His ex learned about the Facebook page after friends and family started contacting her about it.

Speaking to investigators from the Ramsey County sheriff’s office, she said the photos were taken during her relationship with Weigel.

Weigel also posted inflammatory statements about the woman and her boyfriend, according to court documents. In one, he allegedly named her place of employment and said she was unfit to work there.

In an interview with law enforcement, Weigel acknowledged creating the Facebook page and said he did it to “expose” his ex and her boyfriend, the complaint said. He added that his actions were not intended to “hurt anyone.”

Weigel’s attorney, public defender John Riemer, said his client is remorseful over his conduct.

“Mr. Weigel regrets his actions and he wishes he had not done them, and he regrets any embarrassment or any harm that the caused to the victim in this case,” Riemer said.

Weigel is expected to be sentenced in early October.