LOS ANGELES (AP) — The leader of California's legal resistance to the Trump Administration got a strong show of support in his bid to keep his job as attorney general and will face an embattled retired Republican judge in the fall runoff.

Attorney General Xavier Becerra won about 45 percent of Tuesday's vote while former Judge Steven Bailey had about 26 percent with more than 3 million votes counted in the four-way race. Republican attorney Eric Early had 15 percent and Insurance Commissioner Dave Jones, a Democrat who was well funded, had 14 percent.

Becerra, a longtime congressman, was appointed last year by Gov. Jerry Brown to fill the seat vacated when Kamala Harris was elected to the U.S. Senate. He has spent much of his time in office suing the Trump administration to halt or reverse policies he says harm Californians.

In remarks at a Planned Parenthood election party, Becerra told supporters that 2018 was not 2016, a reference to the election that sent Republican Donald Trump to the White House.

"Job one for the attorney general is to have your back," Becerra said. "It's to make sure that I'm protecting everything that you value. Everything that makes California the economic engine of the country."

Becerra, the first Latino to hold the office, was criticized by his opponents for neglecting other priorities because of his obsession with Trump. He's filed more than 30 lawsuits against the administration, challenging policies on immigration, health care and the environment.

But Becerra said he's done plenty of other work, such as cracking down on gangs and charity fraud.

Sue Regan a retired psychiatrist in Sacramento said she voted for Becerra because of his efforts to stand up to Trump.

"I'm hoping that California continues to be a liberal bastion and be the resistance against the Trump administration," Regan said.

Bailey, who recently retired as an El Dorado County Superior Court judge, started as a legislative assistant and was later deputy legislative director for the state Department of Social Services.

He and fellow Republican Early opposed recent voter-approved initiatives that reduced criminal penalties and both support the death penalty. While Becerra is pushing to resume executions in California for the first time since 2006, he has personal reservations about the penalty. Jones had vowed to end capital punishment.

Bailey also said the goal should be to treat those with mental illnesses or drug addictions instead of locking them up. He also criticized Jones and Becerra for seeking to end the state's existing money bail system, which they say takes a harder hit on the poor.

Bailey denied allegations by the state's judicial watchdog of several alleged improprieties, including steering business to an electronic monitoring company where his son worked.

The state Commission on Judicial Performance has scheduled a September hearing to see if sanctions were warranted for improperly accepting gifts and using his judicial office to advance his bid for attorney general.

Bailey said the allegations were politically motivated. Even though he's no longer a judge, he could be publicly admonished, but not disqualified from the attorney general's race.

Early, a Los Angeles attorney specializing in business, entertainment and real estate litigation, attacked Becerra for caring "more about illegal immigrants who have come here and then broken the law" than tax-paying citizens.

Jones, the two-term insurance czar and former state assemblyman, ran to the left of Becerra, advocating for a single-payer health care system and criminal justice reforms such as more rehabilitation and mental illness and drug addiction treatment programs.

Through the third week in May, Jones had $2.3 million in the bank and Becerra had $1.5 million. The Republicans were far behind in fundraising.

___

Associated Press Writer Sophia Bollag contributed to this report from Sacramento.