Contra Costa County District Attorney Mark Peterson resigned from office Wednesday, shortly before he pleaded no contest to a felony perjury charge. He was sentenced to 250 hours of community service and probation.

The abrupt end to Peterson’s 33-year career as a Contra Costa prosecutor, the last seven of which he served as the county’s elected district attorney, stems from his use of more than $66,000 in campaign money between 2011 and 2015 on personal items, including movie tickets, clothes and gasoline.

Peterson’s attorney, Ted Cassman of Arguedas, Cassman & Headley, declined to comment Thursday.

Peterson has said he mistakenly considered the withdrawals a loan. He eventually repaid all of the money to his campaign, including half of it after he learned the account would be audited by the Franchise Tax Board. But Peterson never recorded the withdrawals or expenditures on his state-mandated campaign finance statements, documents that he signed, under penalty of perjury, as accurate.

The California Fair Political Practices Commission in January fined Peterson $45,000.

“When an official makes personal use of campaign funds, it erodes public confidence in the political process by blurring that line between lawful contributions and payments to public officials,” commission staff wrote in a memo recommending the fine.

A civil grand jury recommended in May that Peterson be removed from office. Later that month, the Attorney General’s Office took the case for investigation. On Wednesday, state prosecutors filed 12 felony counts of perjury and one count of felony grand theft.

Peterson’s tenure as district attorney had been tumultuous since his first election in 2010, which followed a nasty campaign against another long-time prosecutor in the office. Some deputy district attorneys alleged that Peterson retaliated against them for supporting his opponent, claims that he denied.

By 2012, three lawsuits had been brought by current and former Contra Costa County prosecutors against their employer. One claimed workplace racism. Another former deputy sued for malicious prosecution after he was charged with the rape of a co-worker, charges that were later thrown out by a judge. A third deputy filed a personal injury suit stemming from an alleged office fistfight.

Peterson was the first district attorney in decades to face removal from office in a proceeding initiated by a civil grand jury. In recent years, however, a number of elected prosecutors have found themselves under serious professional scrutiny.

â–º Former Del Norte County District Attorney Jon Alexander was disbarred in 2014 for misconduct in office, including talking to a represented defendant facing felony charges brought by his office.

Jon Alexander, former Del Norte County District Attorney

Jason Doiy / The Recorder

Alexander was a former methamphetamine addict who derailed a promising Southern California law practice but later resurrected his career by getting clean and winning the 2010 district attorney election in Del Norte on a “death to meth” campaign. Alexander denied the charges and said he was targeted because of his former drug use.

â–º In February, the California State Bar filed disciplinary charges against former Los Angeles City Attorney Carmen Trutanich for allegedly suppressing evidence and allowing false testimony in a death-penalty case he tried as an assistant district attorney in 1986. A federal judge last year overturned the conviction in that case, citing prosecutorial misconduct. Trutanich has denied all the bar’s charges.

â–º For almost two years after his re-election defeat in 2014, former Riverside County District Attorney Paul Zellerbach faced legal questions over his office’s participation in a massive wiretapping program that USA Today found was one of the largest in the nation. In October 2016, a Riverside County judge upheld the legality of the eavesdropping.

Zellerbach also ran into trouble stemming from his 2014 re-election campaign. In January 2015 he pleaded guilty to a charge of misdemeanor vandalism for damaging one of his opponent’s campaign signs. Zellerbach also received a public reproval and one year of professional probation from the State Bar for his sign attack.