Rochester Mayor Lovely Warren agreed to resign shortly before her term ends as part of a deal to settle charges she violated campaign finance rules during her 2017 reelection campaign.

Warren was scheduled to go on trial Monday on felony charges she and two assistants took steps to evade contribution limits. Instead, Warren and her two co-defendants pleaded guilty to accepting campaign contributions that exceeded legal limits, according to the Monroe County district attorney’s office.

The resignation will provide an early end to a tumultuous mayoral term in New York’s third-largest city. Warren had been under heavy criticism for the city’s handling of the suffocation death of Daniel Prude, a Black man who died in March 2020, a week after police held him down on a city street for about two minutes until he stopped breathing.

In reaching the plea on the lesser misdemeanor charge, Warren is able to keep her law license and her pension.

Her resignation will be effective by Dec. 1. Warren was set to leave office in January after losing a Democratic primary earlier this year. Deputy Mayor James Smith would finish out the remainder of her term.

Warren faces a year-long conditional discharge along with the agreement to submit her resignation. She did not answer questions from reporters as she left court.

Warren had previously denied any attempt to evade campaign finance rules, blamed errors on sloppy bookkeeping and referred to the investigation as a “political witch hunt.”

District Attorney Sandra Doorley called the resolution “fair and just” and said it was an important step in promoting ethical elections.

“Moving forward, the ramifications of the Mayor’s conduct spans beyond the criminal justice system. The Monroe County District Attorney’s Office is pleased that all three defendants are willing to take responsibility for their actions and admit their wrongdoing,” Doorley said in a prepared statement.

The plea deal also resolves separate child endangerment charges against Warren. In July, Warren and husband Timothy Granison pleaded not guilty to unrelated charges stemming from a police raid that allegedly turned up a rifle and pistol, and her 10-year-old daughter alone, in the home they share.

Prude’s death received no public attention until months later when his family released police body camera video. Warren had been heavily criticized for the city’s handling of Prude’s death. She claimed she had no knowledge of Prude’s case until his family went public.

But a report commissioned by Rochester’s city council faulted her and the former police chief for keeping critical details of the case secret for months and lying to the public about what they knew.