SACRAMENTO, Calif. (AP) — Republican Nathan Hochman will battle California's Democratic attorney general in the November general election after garnering 18% of the vote in the primary, according to figures released Thursday.

Hochman, the Republican Party's endorsed candidate, will face Rob Bonta in a state that overwhelmingly favors Democrats. Bonta, the only Democrat in the five-way field, won 54.8% of the June 7 primary, according to the latest figures from California's secretary of state.

Under state law, the top two vote-getters advanced to the November election, no matter their party affiliation.

Conservative Republican Eric Early was close behind Hochman with 16.4% of the vote but had no chance of catching up because there weren't enough uncounted ballots to tip the balance.

Sacramento County District Attorney Anne Marie Schubert, running without party affiliation, got 7.7% of the vote. Green Party candidate Dan Kapelovitz had 3.2%.

Hochman is a former federal prosecutor, defense lawyer, a former assistant U.S. attorney general. He and the other GOP candidates have focused on concerns by Californians about rising rates of crime and other problems.

“Californians are done tolerating fearless criminals, our downward spiraling homelessness crisis, and fentanyl ravaging our cities,” Hochman said in a statement Thursday.

Hochman also had grounded his campaign on fighting human trafficking, including by backing a stalled bipartisan bill that would label it a violent felony. He also proposed to coordinate prosecutions of traffickers statewide, seize their assets and begin a statewide human trafficking education campaign.

Bonta, who was appointed by Gov. Gavin Newsom last year to fill a vacancy, is expected to easily win the November election. California’s last Republican attorney general left office in 1999 and the party hasn’t won a statewide election since 2006.