The twisting legal saga of David Peralta came to an abrupt end Friday as the former St. Bernard Parish president signed a plea agreement that spared him jail time and resolved more than two dozen charges against him in two parishes — allegations that ranged from taking kickbacks to forcing employees to help him stalk his ex-wife.

Peralta pleaded no contest to felony counts of malfeasance and abuse of office in addition to one misdemeanor count of stalking. He was ordered to pay $2,500 in fines and serve two months of house arrest and two years of probation.

“I’m relieved,” Peralta told reporters outside the courthouse in Chalmette, tearing up as he reflected upon a tumultuous two-year stretch in which he was indicted four times and lost his job as parish president. “I think it’s been handled quite well.”

Friday’s proceedings capped a humiliating and bizarre fall from grace for Peralta, who agreed, under the terms of the plea deal, never to run for public office again or even to work on another political campaign.

Judge Jerome J. Barbera III also ordered Peralta to undergo a psychiatric evaluation and submit to electronic monitoring during his 60-day house arrest.

Barbera, a retired Lafourche Parish judge, was handling the case because all the St. Bernard Parish judges recused themselves.

The outcome left a bitter taste in the mouth of some observers, who said Peralta’s penalty did not seem to reflect the extent of the embarrassment he brought upon the parish during his controversial tenure. Ron Chapman, a history professor at Nunez Community College and a columnist for the weekly St. Bernard Voice, called the sentence a “slap on the wrist” and worried it would send the wrong message to office-holders.

“Someone holding a political office has a trust, and if you violate that trust, I would think the penalty would be rather severe,” Chapman said in a phone interview. “It’s a serious offense. I’m not sure if the consequences are commensurate” with the crimes.

Parish voters made their attitude clear when they soundly denied Peralta a second term in office. Peralta, who had defeated parish President Craig Taffaro in 2011, suffered an embarrassing defeat at the polls last fall, collecting just 3 percent of the vote and finishing fifth in a seven-person field.

The Peralta scandal began nearly three years ago, when his then-wife, Sharon Schaefer, accused the parish leader of handcuffing, beating and raping her in their Meraux home on her 49th birthday. Peralta denied the claim, insisting the couple had engaged only in “rough sex.” A nasty divorce played out publicly, and a grand jury indicted Peralta on one count of sexual battery, a charge prosecutors later dropped.

Peralta later faced charges of stalking Schaefer in St. Tammany Parish, a case that also was recently dropped, and a grand jury in East Baton Rouge Parish accused him of tapping his campaign account for money with which to gamble.

That six-count indictment charged him with filing false public records and perjury, but prosecutors have agreed to dismiss those counts after Peralta pays an undetermined amount of fees to the state Board of Ethics.

The most recent charges came last summer, when state prosecutors charged Peralta with nearly two dozen counts in St. Bernard Parish, including malfeasance and abuse of office. Among other crimes, the state Attorney General’s Office accused Peralta of accepting a loan from a businessman whose company had a contract with St. Bernard Parish.

Peralta also was charged with asking a parish employee to use a parish computer to track down an address for his ex-wife. The 22-count indictment further accused Peralta of obtaining a list of parish employees’ addresses and using that information to solicit campaign donations.

Peralta, a former New Orleans police sergeant and St. Bernard Parish Sheriff’s Office major, defiantly refused to stepped down, insisting he would be vindicated and accusing then-Attorney General Buddy Caldwell of waging a vendetta against him.

Claiming that Caldwell indicted him for political reasons, Peralta last year filed a federal civil rights lawsuit against the Attorney General’s Office, accusing prosecutors of knowingly using false testimony to indict him.

The turning point in the case began with Caldwell’s defeat last fall by Attorney General Jeff Landry, said Martin Regan, Peralta’s defense attorney.

Referring to Landry, Regan said Friday that he had been grateful for “the opportunity to sit down with someone who is not personally involved in this case, as we found with Mr. Caldwell’s office.”

“Sitting down with someone who had no interest in that fight, we were able to work this out,” Regan said.

Landry’s administration did not push for Peralta to receive jail time and appeared to be content with the sentence.

Brandon Fremin, a prosecutor who leads the Criminal Division under Landry, said Peralta’s case, like others carried over from the Caldwell administration, underwent an extensive review after Landry took office.

“We thought justice might best be served if we left it completely up to the judge,” Fremin said of Peralta’s sentence. “The judge very clearly took all the factors of the plea and the facts into account, and we believe he upheld his obligation with sentencing.”

Follow Jim Mustian on Twitter, @JimMustian.