The former St. Paul City Council candidate whose erratic behavior landed him in jail several times last year has pleaded guilty to posting a nude photo of his estranged wife online.

David Martinez, 39, entered his plea Tuesday in Ramsey County District Court and is scheduled to be sentenced on May 10.

Martinez was charged in December with nonconsensual dissemination of private sexual images, a felony.

However, the defense and prosecution agreed to ask Judge Robert Awsumb to reduce the charge to a gross misdemeanor, defense attorney Shawn Betts said Wednesday.

A stayed one-year sentence also is part of the plea deal, the County Attorney's Office said, followed by two years' probation.

According to the criminal complaint, Martinez's estranged wife reported on July 14 that he had posted a nude photo of her on his website.

A neighbor had alerted her to the image, which was accompanied by a link to an order for protection that the estranged wife had filed against Martinez.

It had been served on him "a short time" before the image was posted.

Police investigating the incident found that the image appeared on a web page called "David Martinez for City Council, Ward 4."

Martinez's alleged post, entitled "Transparency," included text that said the allegations in the order for protection were fabricated.

The woman said Martinez had taken the photo on a private beach in Puerto Rico, and she had not agreed to posting it publicly.

The woman's face was visible in the picture.

Martinez lost his 2018 run for the council.

Paul Walsh • 612-673-4482