Arizona attorney general candidates Kris Mayes and Abe Hamadeh
CNN  — 

Democrat Kris Mayes won the Arizona attorney general race, an automatic recount confirmed. The Arizona Superior Court in Maricopa County announced the results of the recount Thursday.

Mayes beat Republican Abraham Hamadeh by a 280-vote margin. In Arizona, an automatic recount is triggered when the margin between the two statewide candidates who received the largest shares of the vote is equal to or less than 0.5%.

CNN did not project a winner in the race prior to the recount.

The recount resulted in a margin that shrunk by almost half, with Mayes’ lead going from 511 votes in the initial results to 280 votes after the recount. Overall, Mayes gained 196 votes, while Hamadeh gained 427. The two were running to succeed Attorney General Mark Brnovich, who finished a distant third in this year’s Republican primary to take on Democratic Sen. Mark Kelly.

The largest vote changes by far came from Pinal County, where Hamadeh gained 392 votes and Mayes gained 115 votes. In almost every other county, vote changes were in the single digits.

In a statement, Pinal County said the differences were the product of “human error,” with the differences largely coming from Election Day votes that were inadvertently not counted, according to a report from the county. Election workers, according to one possible mistake detailed in the report, may have misinterpreted error messages from a tabulation machine, leading them to think that some ballots had been counted when they actually hadn’t been.

The attorney general race remained the last hope for a statewide victory for a candidate endorsed by former President Donald Trump after Democratic wins over Trump-backed, election-denying GOP nominees in the higher-profile races for governor, US Senate and secretary of state.

But with Hamadeh’s loss, Republicans have fallen short in the top three statewide executive races on this year’s ballot. Democrat Katie Hobbs won the governorship over Republican Kari Lake, while Democrat Adrian Fontes will succeed Hobbs as secretary of state after defeating GOP nominee Mark Finchem. One statewide Republican officeholder who won reelection, state Treasurer Kimberly Yee, avoided intraparty battles and was never endorsed by Trump.

Lake and Finchem unsuccessfully sued to overturn the outcome of their elections. Hamadeh filed a lawsuit in State Superior Court in Mohave County challenging the 2022 election results based on what the suit described as errors in the management of the election and the vote counting. Mohave County Superior Court Judge Lee Jantzen ruled against Hamadeh last week.

Hamadeh, a former Army intelligence officer who worked in the Maricopa County prosecutor’s office, parroted Trump’s 2020 election lies during the campaign and said he would increase the size of the attorney general’s office’s election integrity unit.

“It’s time we lock up some people and put handcuffs on them,” he said at a Trump rally in October.

Mayes, his opponent, served for seven years as a Republican member of Arizona’s public utilities commission, winning statewide elections in 2004 and 2006. She left the GOP in 2019 and has vowed to “depoliticize” the attorney general’s office. However, Mayes has also said she would not enforce abortion restrictions in the state.

This story has been updated with additional developments.