In the rush to replace insecure, unreliable electronic voting machines after Russia’s interference in the 2016 U.S. presidential race, state and local officials have scrambled to acquire more trustworthy equipment for this year’s election, when U.S. intelligence agencies fear even worse problems.

But instead of choosing simple, hand-marked paper ballots that are most resistant to tampering because paper cannot be hacked, many are opting for pricier technology that computer security experts consider almost as risky as earlier discredited electronic systems.

Called ballot-marking devices, the machines have touchscreens for registering voter choice. Unlike touchscreen-only machines, they print out paper records that are scanned by optical readers. South Carolina voters will use them in Saturday’s primary.

The most pricey solution available, they are at least twice as expensive as the hand-marked paper ballot option. They have been vigorously promoted by the three voting equipment vendors that control 88 percent of the U.S. market.

Some of the most popular ballot-marking machines, made by industry leaders Election Systems & Software and Dominion Voting Systems, register votes in bar codes that the human eye cannot decipher. That’s a problem, researchers say: Voters could end up with printouts that accurately spell out the names of the candidates they picked, but, because of a hack, the bar codes do not reflect those choices. Because the bar codes are what’s tabulated, voters would never know that their ballots benefited another candidate.

Even on machines that do not use bar codes, voters may not notice if a hack or programming error mangled their choices. A University of Michigan study determined that only 7 percent of participants in a mock election notified poll workers when the names on their printed receipts did not match the candidates they voted for.

ES&S rejects those scenarios. Spokeswoman Katina Granger said the company’s ballot-marking machines’ accuracy and security “have been proven through thousands of hours of testing and tens of thousands of successful elections.” Dominion declined to comment for this story.

Nearly 1 in 5 U.S. voters will be using ballot-marking machines this year, compared with less than 2% in 2018, according to Verified Voting, which tracks voting technology.

Pivotal counties in the crucial states of Pennsylvania, Ohio and North Carolina have bought ballot-marking machines. So have counties in much of Texas, as well as California’s Los Angeles County and all of Georgia, Delaware and South Carolina. The machines’ certification has often been streamlined in the rush to get machines in place for presidential primaries.

Ballot-marking devices were not conceived as primary vote-casting tools but as accessible options for people with disabilities.

Critics see them as vulnerable to hacking. At last year’s DefCon hacker convention in Las Vegas, it took tinkerers at the ‘Voting Village’ not even eight hours to hack two older ballot-marking devices.

Tampering aside, some of the newer ballot-marking machines have stumbled badly in actual votes. That happened most spectacularly in November when ES&S’s top-of-the-line ExpressVote XL debuted in a Pennsylvania county.

Even without technical troubles, the new machines can lead to longer lines, potentially reducing turnout. Voters need more time to cast ballots and the machine’s high costs have prompted election officials to limit how many they purchase.

“There are a huge number of reasons to reject today’s ballot-marking devices — except for limited use as assistive devices for those unable to mark a paper ballot themselves,” says Doug Jones, a University of Iowa computer scientist who co-authored the voting technology history “Broken Ballots.” ‘

But election officials see ballot-marking devices as improvements over paperless touchscreens, which were used by 27 percent of voters in 2018. They like them because the touchscreens are familiar to voters, looking and feeling like what they have been using for nearly two decades, and officials can use one voting method for everyone.

Michael Anderson, elections director for Pennsylvania’s Lebanon County, said “voters want it.” The county offers voters both machine- and hand-marked ballots.

“When we give them a paper ballot, the very first thing they say to us is, ‘We’re going back in time,’” he said.

New York State election commission co-chair Douglas Kellner was an early critic of paperless electronic voting machines. But he is confident in a ballot-marking device, the ImageCast Evolution by Dominion, certified for use in his state. He said safeguards built into the machines and security protocols make a hack of the Image Evolution “extraordinarily unlikely.”

But Jones is among experts who think today’s ballot-marking devices undermine the very idea of retaining a paper record that can be used in audits and recounts. It’s an idea supported by a 2018 National Academies of Sciences report that favors hand-marked paper ballots tallied by optical scanners. Some 70 percent of U.S. voters used them in the past two presidential elections and will do so again in November.

One state, Colorado, is banning bar codes from ballot-marking voting machines beginning in 2021.

Election administrators who reject hand-marked paper ballots as antiquated, inconvenient or unwieldy have few options beyond ballot-marking devices. That’s because the $300 million voting equipment and services industry is so insular and entrenched.

The industry faces virtually no federal regulation even though election technology was designated critical infrastructure in January 2017. Federal certification guidelines for voting machine design are 15 years old and voluntary. The leading vendors have resisted publicly disclosing third-party penetration testing of their systems.

”It’s a self-reinforcing system that keeps it frozen in a place in the past,” said Eddie Perez, a former product development director for Hart InterCivic, the No. 3 voting equipment company, now with the OSET Institute, a nonprofit that promotes reliable voting solutions. “They don’t want to make any changes in the equipment unless they absolutely have to.”

The Republican-controlled Senate has refused to take up bills that would, among other things, require a voter-verifiable paper trail and require bulletproof postelection audits. Republicans say the federal government should not impinge on states’ authority to oversee elections.

Northampton County, on Pennsylvania’s eastern edge, mirrored the state’s choice in 2016 by voting for Donald Trump after twice choosing Barack Obama. Last Election Day, it became ground zero in the debate over ballot-marking devices.

The county’s new ExpressVote XLs failed doubly.

First, a programming misconfiguration prevented votes cast for one of three candidates in a judge’s race from registering in the bar codes used to count the vote. Only absentee ballot votes registered for the candidate, said the county executive, Lamont McClure. The other problem was miscalibrated touchscreens, which can “flip” votes or simply make it difficult to vote for one’s desired candidate due to faulty screen alignment. They were on about one-third of the county’s 320 machines, which cost taxpayers $8,250 each.

One poll judge called the touch screens “garbage.” Some voters, in emails obtained by the AP in a public records request, said their votes were assigned to the wrong candidates. Others worried about long lines in future elections.

Voters require triple the time on average to navigate ES&S ballot-marking machines compared to filling out hand-marked ballots and running them through scanners, according to state certification documents.

ES&S said its employees had flubbed the programming and failed to perform adequate preelection testing of the machines or adequately train election workers, which would have caught the errors.

Election commissioners were livid, but unable to return the machines for a refund because they are appointees.

“I feel like I’ve been played,” commissioner Maudeania Hornik said at a December meeting with ES&S representatives. She later told the AP she had voted for the devices believing they would be more convenient than hand-marked paper ballots, especially for seniors.

“What we worry is, what happens the next time if there’s a programming bug — or a hack or whatever — and it’s done in a way that’s not obvious?” said Daniel Lopresti, a commissioner and Lehigh University computer scientist.

ES&S election equipment has failed elsewhere. Flawed software in ballot-marking devices delayed the vote count by 13 hours in Kansas’ largest county during the August 2018 gubernatorial primary. Another Johnson County, this one in Indiana, scrapped the company’s computerized voter check-in system after Election Day errors that same year caused long lines.

“I don’t know that we’ve ever seen an election computer — a voting computer — whose software was done to a high standard,” said Duncan Buell, a University of South Carolina computer scientist who has found errors in results produced by ES&S electronic voting machines.

Voting integrity activists have sued, seeking to prevent the further use in Pennsylvania of the ExpressVote XL. Grassroots organizations including Common Cause are fighting to prevent their certification in New York State.

ES&S defends the machine. In a Dec. 12 filing in a Pennsylvania lawsuit, company executive Dean Baumer said the ExpressVote XL had never been compromised and said breaches of the machine “are a practical impossibility.”

ES&S lobbied hard in Pennsylvania for the ExpressVote XL, though not always legally.

After ES&S won a $29 million contract in Philadelphia last year in a hasty procurement, that city’s controller did some digging. She determined that ES&S’ vice president of finance had failed to disclose, in a mandatory campaign contribution form, activities of consultants who spent more than $400,000, including making campaign contributions to two commissioners involved in awarding the contract. ES&S agreed to pay a record $2.9 million penalty as a result. It said the executive’s failure to disclose was “inadvertent.”

The Philadelphia episode contradicts claims by ES&S officials, including by CEO Tom Burt in Jan. 8 testimony to a congressional committee, that the company does not make campaign contributions.

Public records show ES&S contributed $25,000 from 2014-2016 to the Republican State Leadership Committee which seeks GOP control of state legislatures.

ES&S has also paid for trips to Las Vegas of an “advisory board” of top elections officials, including from South Carolina, New York City and Dallas County, Texas, according to records shared with the AP from a Freedom of Information request.

Philadelphia paid more than twice as much for its ExpressVote XL machines per voter ($27) as what Allegheny County, home to Pittsburgh, disbursed ($12) for hand-marked paper ballots and scanners — plus ballot-markers for the disabled — from the same vendor.

Allegheny County’s elections board rejected ballot-marking devices as too risky for all but disabled voters. Its vice chair, state judge Kathryn Hens-Greco, regretted during a September hearing having to award ES&S the county’s business at all given its behavior in Philadelphia and elsewhere.

But no other vendor offered a hand-marked option with enough ballot-configuration flexibility for the county’s 130 municipalities.

While cybersecurity risks can’t be eliminated, Hens-Greco said, the county would at least have “the ability to recover” from any mischief: a paper trail of hand-marked ballots.