PHOENIX (AP) — The appeal of Donald Trump's movement was put to the test Tuesday in the race for governor of Arizona, a crucial battleground state where the former president's allies have taken control of the Republican Party.

Democrat Katie Hobbs took a lead over Republican Kari Lake in initial results, which reflected mail ballots returned ahead of election day. Her lead was expected to narrow considerably as ballots cast in person on election day were reported.

Lake, a former television news anchor, says she would not have certified the state's 2020 election results. Her television-ready demeanor, confrontations with journalists and combative message for Democrats made the first-time candidate a rising star on the right whose future in national politics is already being debated.

Hobbs, Arizona's secretary of state, rose to prominence defending the integrity of President Joe Biden's victory in Arizona, where he eked out the smallest margin of any state he won two years ago.

The results will be a window into the pulse of the electorate in Arizona, a longtime Republican stronghold that turned toward Democrats during the Trump era. They'll provide insight into whether Biden’s success here in 2020 was a onetime event or the onset of a long-term shift away from the GOP.

Trouble with vote-tabulation machines at about 25% of polling places in Maricopa County, Arizona's most populous, generated criticism on social media but officials said every vote would be counted.

As expected, Democrats led in early returns for all statewide races. Hobbs and other Democrats told supporters they were encouraged by the results but warned a long slog of counting was ahead and it could be days before a winner is known.

“I have every confidence that the counties administering this election conducted a free and fair election, and their results will be accurate,” Hobbs told supporters gathered in Phoenix. “But they will take time, so prepare for a long evening and a few more days of counting.”

The election comes as Biden struggles from lagging approval and Trump strongly hints that he will run again in 2024.

With such high stakes, Arizona has been central to efforts by Trump and his allies to cast doubt on Biden’s victory with false claims of fraud. Trump-endorsed candidates who deny the legitimacy of Biden's victory won GOP primaries up and down the ballot and could take control of offices with a central role in elections.

Nine in 10 voters say the future of democracy in the U.S. is a factor in their voting decisions, according to AP VoteCast, an expansive survey of more than 3,200 voters in Arizona. They were evenly split between the two candidates for governor. Roughly 4 in 10 say it is the single most important factor.

A majority — roughly 7 in 10 voters — say they are confident that votes will be counted accurately in this year’s election. Among these voters, about 6 in 10 backed Hobbs. Among the roughly one-quarter who said they were not confident that votes would be counted accurately, about 8 in 10 backed Lake.

Lake said she was confident she will make up the gap and overtake Hobbs, reminding her supporters that she was down in early returns from the GOP primary before overtaking her establishment-backed rival as more ballots were counted.

“God did not put us in this fight because it was going to be easy,” Lake told supporters at a GOP celebration in Scottsdale. “Not one thing that we’ve had to go through has been easy.”

She condemned the printer mishap in Maricopa County, calling it “another stark reminder that we have incompetent people running the show in Arizona” and pledging that her “first line of action is to restore honesty to Arizona elections.”

Hobbs has cast the race for governor as a contest between sanity and chaos, branding Lake as “seriously dangerous" and drawing attention to the Republican's opposition to abortion rights. That quest was helped by a judge's ruling in September that said prosecutors can enforce a law dating to 1864 that outlaws all abortions unless a patient's life is in danger. The ruling was later put on hold.

Hobbs, a social worker before turning to politics, was weighed down by her decision not to debate Lake. She said she didn't want to give Lake a platform to share election lies, pointing to a raucous GOP primary debate that Hobbs said Lake turned into a “spectacle.” She ran a cautious campaign, sticking largely to scripted and choreographed public appearances.

Lake brought people dressed as chickens — and sometimes live hens — to campaign events to make the case that Hobbs was scared to confront her. She also highlighted a successful discrimination lawsuit brought by a Black woman who was fired as a policy adviser to state Senate Democrats while Hobbs was the top Senate Democrat.

Lake is well known in much of the state after anchoring the evening news in Phoenix for more than two decades. She ran as a fierce critic of the mainstream media, which she said is unfair to Republicans.

Polished in front of the camera and comfortable in front of a crowd, Lake built an enthusiastic following and drew international media attention.

She was endorsed by Trump, who admired her ability — only slightly exaggerated — to respond to any question with a message about fixing elections. Lake has repeatedly refused to say that she would accept the results of the election if she loses.

The Hobbs team bet that the race will be a referendum on Lake, and that Arizonans wouldn't like what they saw.

Nearly half of Arizona voters say the economy is the most important issue facing the country, according to AP VoteCast. And nearly all voters said inflation was a factor in their votes, with about half saying it was the single most important factor.

For about two-thirds of Arizona voters, the U.S. Supreme Court’s overturning of Roe v. Wade, the ruling that recognized a constitutional right to abortion, was an important factor. Those voters overwhelmingly favored Hobbs over Lake.

A slight majority of voters approve outgoing Gov. Doug Ducey’s decision to send migrants seeking asylum in the U.S. to northern Democratic states. A large majority — almost 8 out of 10 — favor increasing law enforcement presence at the U.S.-Mexico border.

Federal and state election officials and Trump’s own attorney general have said there is no credible evidence the election was tainted. The former president’s allegations of fraud were also roundly rejected by courts, including by judges Trump appointed. A hand recount led by Trump supporters in Arizona’s largest county found no proof of a stolen election and concluded Biden’s margin of victory was larger than the official count.

Ducey is blocked by term limits from seeking another term. Like most of the rest of Arizona's Republican establishment, he backed Lake's rival Karrin Taylor Robson in the primary, saying Lake was “putting on a show.” But he endorsed her for the general election and, as co-chairman of the Republican Governors Association, oversaw $11 million in advertising on her behalf.

___

Learn more about the issues and factors at play in the midterms at https://apnews.com/hub/explaining-the-elections. And follow the AP’s election coverage of the 2022 elections at https://apnews.com/hub/2022-midterm-elections.

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