A federal judge ruled on Friday that North Carolina’s recent voter purges likely violated federal law, ordering the restoration of voting rights to thousands of people—most of them minorities—in an emphatic ruling. U.S. District Judge Loretta Biggs, who previously described North Carolina’s system of revoking voting rights as “insane” and reminiscent of Jim Crow–style voter suppression, held that the purges constituted a “flawed process” that ran afoul of the National Voter Registration Act.

“Voter enfranchisement cannot be sacrificed when citizens through no fault of their own have been removed from the voter rolls,” Biggs concluded, writing that “the balance of the equities and public interest factors weigh decidedly in favor of protecting eligible voters who are being removed from the voter rolls.” She held that North Carolina must ensure that the purged voters are able to vote in the upcoming election so long as they remain otherwise eligible.

North Carolina’s peculiar system of voter purges has drawn nationwide outcry in recent days, spurred by an NAACP lawsuit and seconded by the Justice Department. In the state, any person can revoke anyone else’s voting rights. An individual need simply gather mail that was returned as undeliverable, then challenge the voter registration of residents at those addresses. If those voters do not appear at a county board of elections or return a notarized form, their voting rights are nullified. Republican activists have used this method to purge nearly 6,700 voters from the rolls throughout the state, a majority of them black.

Because the NAACP brought suit on behalf of voters in just three counties—Beaufort, Moore, and Cumberland—Biggs restricted her order to those counties. She ordered that all voters recently purged through the mass disenfranchisement scheme in those counties have their rights restored. That decision will likely restore voting rights to about 4,500 people, so long as county election boards comply with Biggs’ order.

Given that Republican-controlled election boards have colluded to curtail the voting rights of minorities for months, their compliance with the new order is by no means certain. The Justice Department still plans to send election monitors to several North Carolina counties at the epicenter of this voting rights crisis on Election Day to ensure compliance with federal law.

Read more Slate coverage of the election.