When Texas officials announced in late January that as many as 58,000 noncitizens may have voted illegally in state elections over nearly two decades, top Republicans — including President Trump — quickly warned about the prevalence of voter fraud and the need to crack down on it.

But just as quickly, the numbers stopped adding up.

First, on Jan. 25, the secretary of state instructed counties to give voters 30 days to prove their citizenship before canceling their registration. Then, four days later, the office began calling local election officials to say that thousands of people on the list were in fact U.S. citizens, eligible to vote.

The episode is the latest in bungled attempts by states to show that huge numbers of noncitizens are registered to vote and have cast ballots in U.S. elections. In North Carolina, legislative leaders said in 2014 that more than 10,000 suspected noncitizens were registered to vote, but state election officials found that number was vastly overstated and determined that only 11 noncitizens voted that fall. In Florida in 2012, a list of 180,000 possible noncitizens ultimately led to the removal of 85 voters from the rolls. Similar claims have been made in Colorado, Indiana and Kansas.

Those touting the large numbers, almost all Republicans, say the hunt for evidence of voter fraud is necessary to protect the integrity of elections. But the pattern of overblown proclamations also shows the data is easily misinterpreted — prompting voting rights activists to accuse Republicans of using the numbers to discourage eligible voters to cast ballots.

One Texas Democrat joked bitterly that Republicans were conjuring images of “caravans of voters” to alarm Texans about the threat of immigrant voters — an allusion to Trump’s claims that thousands of undocumented immigrants are walking toward the southern border.

“This raises justifiable concerns that this is an effort to suppress voting and purge voter lists, and there are people that ought to be ashamed of how we’ve gotten here,” said Kirk Watson, a Democratic state senator in Texas. Watson hopes to question Texas Secretary of State David Whitley about the voter list at a committee hearing Thursday morning in Austin.

Across the country, many noncitizens have legal driver’s licenses, and driving records typically list their citizenship status. Many such drivers have subsequently become citizens, but their driving records might not have been updated. If out-of-date driver data is cross-referenced with a list of registered voters, that could show incorrectly that the registered voter is not a citizen.

In North Carolina, election officials used a database maintained by the U.S. Department of Homeland Security to eliminate thousands of suspected noncitizens from the original list of 10,000. Several anecdotal examples in Texas show similar circumstances; one woman, a reporter for the Dallas Morning News, wrote last week that she hasn’t renewed her driver’s license since becoming a citizen in 2016 because it does not expire until 2020 — so her records with the state are outdated.

Whitley announced on Jan. 25 that his office had discovered about 95,000 noncitizens registered to vote, and that about 58,000 of them had voted at least once over an 18-year period. The numbers resulted from a year-long investigation in which names provided by the Texas Department of Public Safety, he said, were matched against a state database of voters.

“I would like to thank the Department of Public Safety for providing us with this valuable information,” Whitley announced, “so that we can continue to guarantee the right to vote for all eligible Texas voters, who should not have their voices muted by those who abuse the system.”

The announcement prompted an avalanche of outrage about the threat of voter fraud. Texas Attorney General Ken Paxton (R) tweeted, “VOTER FRAUD ALERT” and promised to deploy the election fraud unit he created last year and to “spare no effort in assisting with these troubling cases.” Gov. Greg Abbott (R) described the news as evidence of “illegal vote registration.” And President Trump weighed in with a tweet as well: “These numbers are just the tip of the iceberg. All over the country, especially in California, voter fraud is rampant. Must be stopped.”

Whitley has provided no explanation for how his office determined the citizenship status of the people on the list — for instance, whether they used the federal database that helped North Carolina dramatically reduce its list. Neither his office nor the Department of Public Safety have responded to repeated requests for comment. The attorney general’s office declined to answer questions about the voter list, citing an ongoing investigation.

Local officials in Texas quickly realized many of the names they were sent belonged to naturalized citizens. El Paso’s list included a woman who works at the elections office and whose colleagues threw her a naturalization party at the office when she became a citizen in 2017, the Texas Tribune reported last week.

In Galveston, election administrators removed duplicates before sending a first batch of letters to 92 of the approximately 830 people listed as noncitizens. Then the Secretary of State’s office called to tell them there were problems with the list. It turned out 64 of those 92 voters were citizens.

That story played out in counties across Texas, with state officials calling the county election administration to remove thousands of names from the original list. McLennan County, home to Waco, was told to disregard all 366 names originally sent. How many suspected noncitizen voters remain on the statewide list is unknown.

Critics of the effort, including Watson, the state senator, say its real purpose is to purge eligible voters from the registration rolls for political advantage. Polls show naturalized immigrants overwhelmingly supported Democratic candidates in the 2018 midterm elections.

Voting rights advocates also pointed to a bill coursing through the Texas legislature that would require voter-registration applicants to prove their citizenship. In addition, Paxton, the attorney general, is seeking additional funding to investigate election crimes.

Beth Stevens, of the Texas Civil Rights Project, said she believes the secretary of state’s first announcement was designed to help win support for these measures. She noted that one version of the citizenship bill was filed Jan. 28, three days after the announcement — and pointed to a tweet from Abbott promising to “work on legislation to safeguard against these illegal practices.”

“There definitely is a broader purpose to restrict access to voting in Texas and affect in a very real way the ability of eligible voters to cast ballots,” Stevens said. At least one lawsuit has been filed in Texas seeking to block the removal of voter names from the rolls.

Others accused officials of trying to gin up support for more state funding for border security — a function of the Department of Public Safety, which produced the original list of possible noncitizen voters.

Texas Republicans might not have anticipated the anger of U.S. citizens when they discovered their names were on the original list — anger that voting rights activists said could prompt a backlash of heightened political engagement by naturalized Americans.

Michael McDonald, a political science professor at the University of Florida who focuses on election law, said the school did a study when a similar purge attempt happened in Florida. “We had actual administrative records of people who had been flagged for similar purging,” he said. “But people became offended that they had been flagged in this way. And they turned out in higher numbers.”