Republicans who backed Donald Trump’s failed efforts to overturn the 2020 election were positioned in several states to win key offices overseeing voting in the next presidential contest, but the GOP fell short of gaining that power in closely watched Pennsylvania.

Doug Mastriano, the GOP nominee for governor who was seen outside the U.S. Capitol on the day of the Jan. 6, 2021, insurrection and regularly communicated with Donald Trump as the then-president tried to reverse his loss to Joe Biden, was defeated by Democrat Josh Shapiro on election night. Pennsylvania’s governor appoints the secretary of state, who is the top voting official.

In other results, Alabama voters elected state Rep. Wes Allen, who backed a groundless lawsuit to overturn Biden’s victory, as their secretary of state. In Indiana, Diego Morales, who ousted the Republican incumbent in the party primary by repeating Trump’s election lies, won the race for secretary of state by defeating Democrat Destiny Scott Wells.

Wyoming Republican Chuck Gray, a state lawmaker who also endorsed efforts to overturn the 2020 election, was running unopposed for secretary of state.

All told, half of the 22 Republicans vying to be secretaries of states — and overseeing elections in most states — have repeated Trump’s election lies. Seven endorsed his attempts to overturn the will of the people and remain in power.

“If they win, we’re going to have someone who’s run on a platform of election denial, saying, ‘Actually, elections are only legitimate when my candidate wins,’” said David Becker, executive director of The Center for Election Innovation & Research and co-author of “The Big Truth,” a book warning of the dangers of Trump’s election lies.

In Arizona, state Rep. Mark Finchem, who attended Trump’s rally on Jan. 6, 2021, right before the violent assault on the U.S. Capitol, has made clear he would not have certified Biden’s 2020 win in that state. The GOP nominee in Nevada, Jim Marchant, made the same promise.

In New Mexico, Republican Audrey Trujillo cheered on a failed appeal to the U.S. Supreme Court in 2020 to overturn Biden’s win.

Republican Kristina Karamo in Michigan insists Biden didn’t actually win her state, but he did — and by more than 154,000 votes. Less than two before this year’s midterms, Karamo sued to change Detroit’s election procedures. A judge dismissed the case on Monday, saying there was no evidence to support the allegations. On Tuesday she tweeted a post from a conspiracy website spreading more doubt on the voting in Democratic Party’s bastion in the state.

The candidacies from election conspiracists have triggered big spending in the contests, predominantly by Democrats and their allies. Their ads pleaded for voters to think carefully before entrusting such candidates with the job of running elections.

Mastriano, for example, arranged for buses to transport people to Trump’s Jan. 6 rally in Washington, which took place just before the riot. As a candidate, Mastriano promised to appoint someone who would wipe clean the voter rolls, forcing the state’s roughly 8.8 million voters to re-register.

Alabama’s Allen backed a lawsuit to overturn Biden’s win; the U.S. Supreme Court tossed the challenge.

In Wisconsin, the state’s bipartisan elections commissions oversees elections, but some Republicans want to change that. Democratic Gov. Tony Evers has blocked bills from the GOP-controlled Legislature that would wrest control of voting away from the commission.

Evers was running against Republican Tim Michels, a businessman backed by Trump who has his own plan for making the commission friendlier to Republicans.

Many Republican secretaries of state did rebuff Trump’s efforts to overturn the 2020 election and they won primaries against challengers who questioned that outcome. The most prominent example was in Georgia, where Secretary of State Brad Raffensperger rejected Trump’s private entreaties to “find” enough votes to declare him winner of the state, which Biden ally won.

Raffensperger’s refusal infuriated Trump, who recruited a primary challenger who lost badly in the May primary. Raffensperger was up against Democratic state Sen. Bee Nguyen on Tuesday.

___

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