SACRAMENTO, Calif. (AP) — A former judge running a longshot campaign to unseat California's attorney general is facing a judicial ethics tribunal two months before the November election.

Steven Bailey, a Republican who served as an El Dorado County judge from 2009 through August 2017, is accused of using the job to aid his political campaign, improperly accepting gifts and steering business to a firm where his son worked.

Three special masters from the Commission on Judicial Performance on Tuesday began considering the allegations.

The case against Bailey is "overly zealous" and "politically motivated," James Murphy, one of Bailey's attorneys, said during opening statements at the Tuesday hearing.

The ethics commission has a "mountain" of evidence Bailey's conduct was inappropriate for a judge, including testimony from more than 20 witnesses and over 200 exhibits, said Mark Lizarraga, the lawyer presenting the commission's case.

The hearing in Sacramento creates another hurdle in Bailey's uphill campaign against Attorney General Xavier Becerra, a Democrat appointed last year by Gov. Jerry Brown to fill a vacancy. Becerra is seeking his first full four-year term.

Becerra easily won the June primary with 46 percent of the votes. Bailey advanced to the runoff 21 points behind in second place.

No decision is expected from the commission until well after the Nov. 6 election. Bailey could be publicly admonished but he can't be disqualified from the attorney general's race.

Murphy denies Bailey's actions interfered with his judicial impartiality and blamed inadvertent errors for several of the allegations, including that Bailey provided a written testimonial for a political survey company.

The commission is deciding whether to discipline Bailey over claims of conduct "that brings the judicial office into disrepute" and of "willful misconduct in office" — the harshest charge and enough that it could have prompted his removal if he still were on the bench.

Bailey sat behind his lawyers as two women he worked with in El Dorado County described what they called shocking remarks he made about a gay person.

He denies that he was showing bias by telling another judge in response to a compliment about a shirt that he got it from a "gay guy" and that "gays really know how to dress."

He also faces allegations that he improperly used his judgeship to raise funds and promote his candidacy for attorney general. Bailey says he retired months before filing his formal declaration of candidacy in February.

He is also alleged to have repeatedly ordered defendants to use an electronic monitoring service without disclosing that his son worked at the company providing it or that the company's owner was a friend who worked on his 2008 judicial campaign. The commission also alleges he ordered a defendant to pay $140 in restitution in 2009 after a letter signed by the judge's son said the man owed that amount for electronic monitoring.

Bailey says he followed the ethics advice of other judges that he did not have to routinely disclose the relationship with his son, and that the owner was a "professional acquaintance" with no real involvement in his campaign. He says the monitoring company was approved by the county probation department, as required by law, and that he arranged to have a second, competing company also provide monitoring services.

Bailey also is accused of accepting hundreds of dollars in gifts between 2009 and 2012, including nearly $350 from a Placerville attorney. The commission says he appointed the same attorney to oversee a case in 2011 at the unusually high rate of $350 an hour to be paid by the defendant, without disclosing the attorney was a friend.

He denied failing to report or falsely reporting travel-related payments and reimbursements, saying he believed all the gifts were permitted.

The hearing before three judges appointed by the state Supreme Court is expected to last until Sept. 14. They then have about 60 days to report their findings to the commission.

Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.