The state’s judicial disciplinary agency has harshly criticized former Contra Costa County Judge Bruce Mills for misconduct in two cases — and his “shifting explanations for his conduct” — and barred him from future judicial service.

Mills, a judge since 1995, retired from the Superior Court on May 31 while his disciplinary case was pending. The Commission on Judicial Performance said Tuesday it was imposing the most severe sanction available for a retired judge, a public censure and permanent disqualification from judicial employment in California. The commission could have ordered him removed from the bench had he not retired.

Noting that Mills had been been disciplined several times in the past, the commission said it found a “strong likelihood” that he would commit further misconduct if he returned to the bench as a judge or lower-level judicial officer.

Mills’ lawyer, James A. Murphy, was unavailable for conduct. He had previously accused the commission of a conflict of interest because one of the recent cases involved a defendant, Joseph Sweeney, who had publicly accused the commission of covering up judicial misconduct.

The commission rejected Murphy’s argument last year, and the state Supreme Court in December denied Murphy’s attempt to halt the disciplinary proceedings. Mills could appeal Tuesday’s order to the state’s high court.

Mills, a former prosecutor, was appointed to the bench by Gov. Pete Wilson and later was elected by county voters to a succession of six-year terms, most recently in 2014.

The commission privately reprimanded him in 2001 for ignoring a defendant’s request for a lawyer and trying to coerce the defendant to plead guilty. It publicly reprimanded him in 2006 for making “discourteous” and “demeaning” comments to people appearing in his court, and again in 2013 for contacting a juvenile court judge who was hearing a case against Mills’ son.

In Tuesday’s order, the commission said Mills sentenced Sweeney, who had been found in contempt of court by another judge in a family-law case, to 25 days in jail in August 2016 but told him he could get the sentence cut in half for good behavior.

But Mills imposed the sentence without half-time credits, told the sheriff’s office not to reduce Sweeney’s term, and relented only when Sweeney’s lawyer contacted him nine days later, the commission said.

When the commission first asked why he had changed his mind, Mills cited Sweeney’s history of filing appeals, and complaints against the commission, and said he wanted to avoid a “constitutional crisis.” Later, he claimed he had followed the advice of his supervising judge that Sweeney was eligible for the reduction, the commission said.

Mills’ “evolving explanations and defenses concerning the Sweeney matter portrayed a lack of candor and honesty,” the commission concluded.

In the other recent case, the commission said, while a jury was deliberating drunken-driving cases in March 2016, Mills met privately with the prosecutor, talked about his own experience in prosecuting such cases, and mentioned data that might be used to help the prosecution.

The jury deadlocked, but Mills did not remove himself from the case until the district attorney’s office disclosed the private conversation, the commission said. Mills told a disciplinary panel that he had simply been sharing a “war story” with the prosecutor, but the commission said he had violated a prohibition against private conversations with an interested party about issues related to the case.

Bob Egelko is a San Francisco Chronicle staff writer. Email: begelko@sfchronicle.com Twitter: @BobEgelko