SAN FRANCISCO — Retired judges can take jobs in the public sector even if their judicial terms still have time to run, the California Court of Appeal ruled Friday.

The decision hands a win to Justice Arthur Gilbert and the California Judges Association. Gilbert brought a legal challenge in 2012, saying he may wish to retire and seek other public-sector employment before his 12-year term concludes in 2019.

Controller John Chiang and Attorney General Kamala Harris had opposed him, persuading a superior court judge that the California Constitution bars sitting judges from other public-sector employment until their full terms expire.

“I’m certainly thrilled with the opinion,” Gilbert said Friday afternoon, adding that it will “create a sense of certainty” for judges contemplating a career change.

Gilbert sits on the Second District Court of Appeal in Ventura, so the appeal was transferred to the Orange County-based Fourth District Court of Appeal. Even then, the Fourth District sought advice from the California Supreme Court’s Committee on Judicial Ethics Opinions on whether it could decide the case, given that all appellate justices could have an interest in the outcome. The committee advised the court it could proceed under the “rule of necessity,” according to Justice William Rylaarsdam’s opinion for the Fourth District on Friday.

At issue is Article VI, Section 17, which states: “A judge of a court of record may not practice law and during the term for which the judge was selected is ineligible for public employment or public office other than judicial employment or judicial office.”

That provision came into play in the Bay Area in 2007, when newly elected Santa Clara County District Attorney Dolores Carr announced she had hired Judge Kevin Murphy to be her chief assistant, then was forced to backtrack a few days later.

The initial focus of the appeal was on the phrase “the term.” Gilbert, who was represented by Jones Day partner Elwood Lui—himself a retired appellate justice—argued that the term ends on the judge’s retirement, regardless of when it occurs. Chang, who was represented by the attorney general’s office, argued that interpretation would render the phrase “for which the judge was selected” meaningless.

The Fourth District instead focused on the initial phrase, “a judge of a court of record.” That can only refer to sitting judges, Rylaarsdam concluded, because once a judge retires he or she is no longer “a judge of a court of record.”

“Section 17 renders only a sitting judge ineligible for other public office or public employment during the term for which that judge was selected,” Rylaarsdam wrote. “Thus, it does not prohibit any person who has resigned or retired from a judicial office—as Gilbert contemplates doing—from immediately commencing public service in another capacity.”

The state’s reading is at best ambiguous, Rylaarsdam added, and ambiguity must be construed in Gilbert’s favor. Justices Eileen Moore and David Thompson concurred.

The state had argued that the provision was designed to prevent judges from accepting offers of employment in exchange for favorable rulings, but Rylaarsdam found that “absurd” because the provision wouldn’t stop private-sector employers from doing the same thing. In any event, he wrote, retired judges can be criminally prosecuted if they do in fact accept such a bribe.

Lui said Friday he’s glad judges who are contemplating retirement­—or reupping for another term—won’t be inhibited by “this ridiculous reading of the law.” The result is “we’ll have judges who’ll make decisions about how long they want to stay without a penalty being imposed on them.”

Morrison & Foerster of counsel Miriam Vogel, also a retired appellate justice, represented amicus curiae California Judges Association.

Contact the reporter at sgraham@alm.com.