On Jan. 25, Texas Secretary of State David Whitley issued a shocking advisory alleging that 95,000 noncitizens were on the state’s voter rolls, 58,000 of whom had cast at least one ballot. Whitley, a Republican, directed county registrars to commence an immediate purge of these noncitizens using lists he would provide. Texas Attorney General Ken Paxton, also a Republican, promptly tweeted a “VOTER FRAUD ALERT” summarizing Whitley’s findings, and President Donald Trump repeated Whitley’s claims two days later. By that point, counties had already begun notifying targeted voters that they would be purged from the rolls.

On Friday, Whitley quietly promised to rescind his January advisory and halt Texas’ voter purge as part of a settlement with multiple voting rights groups. The factual basis of Paxton and Trump’s tweets has been not just undermined, but fully revoked. Friday’s settlement is a good reminder to be incredibly skeptical of government officials who make eye-popping claims of voter fraud and whose partisan interests are at stake. Over and over and over again, these claims are later proved to be extremely dubious—if not outright false.

Whitley compiled his purge list by using Department of Public Safety records to identify individuals who presented documents indicating that they were noncitizens when they obtained or renewed a driver’s license. It cross-referenced that list with the voter rolls, and voilà, found 95,000 names that appeared on both. What Whitley did not consider is the fact that more than 50,000 Texans are naturalized each year—and when they gain citizenship, they do not have to inform the Department of Public Safety. Thus, it’s overwhelmingly likely that a huge number of people Whitley flagged have become U.S. citizens and are lawful voters. As I explained in February: “Driver’s licenses issued to non-citizens are valid for six years, and over the last six years, nearly 350,000 Texas adults have been naturalized. If even one-third of those adults registered to vote, they could easily account for the total number of ‘non-citizen’ voter registrants on Whitley’s list.”

So Whitley’s list didn’t really target noncitizens; it targeted naturalized citizens, which happens to be unconstitutional. In response, a coalition of voting rights groups—including Mexican American Legal Defense and Education Fund, the League of United Latin American Citizens, the American Civil Liberties Union, Dēmos, the Lawyers’ Committee for Civil Rights Under Law, and the Texas Civil Rights Project—filed lawsuits. A federal judge blocked the purge in late February, describing it as “ham-handed,” “a solution looking for a problem,” and an effort “to intimidate the least powerful among us.”

Seeing the writing on the wall, Whitley chose to settle the cases rather than suffer a protracted court battle over his indefensible purge. Under the terms of Friday’s settlement, Whitley must retract his January advisory and ask counties to stop purging voters on the basis of the lists he sent. Instead, Texas will undertake a narrow and restrained approach, using much more detailed, precise criteria and up-to-date information to maintain its voter rolls. Naturalized citizens will not be targeted, and voters suspected of lacking citizenship will have a real opportunity to prove they’ve been misidentified. The state will train county registrars to ensure that they do not purge voters on the basis of incomplete or suspect data.

After the Texas purge began, I noted that Whitley had taken a page from the Kris Kobach playbook, tossing out a wildly inflated claim of noncitizen voting, then used the ensuing panic to justify mass disenfranchisement. But that tactic does not necessarily work when voting rights advocates are prepared to pummel the state with lawsuits that uncover the lies and duplicity used to concoct the state’s initial claim (or when the initial claim is so easily proven to be bogus). The Friday settlement ending Texas’ planned purge is an object lesson in the vital role that swift, smart lawyering can play in safeguarding the franchise. If the state hadn’t faced an immediate hail of lawsuits, it may well have gotten away with its lawless assault on suffrage.