Updated

A federal judge ordered three North Carolina counties to restore thousands of voter registrations canceled too close to Election Day after the NAACP sued over the removals.

U.S. District Judge Loretta Biggs issued the preliminary injunction Friday after an emergency hearing earlier in the week on NAACP allegations that those counties — and possibly others — purged voter rolls through a process disproportionately targeting blacks.

Biggs said the three counties must restore voter registrations canceled in the 90 days preceding the election because of a federal law prohibiting blanket removals that close to Election Day. She concluded that Cumberland, Beaufort and Moore counties had gone about "systematically purging between 3,500 and 4,000 voters from registration rolls" since August.

Early voting ends Saturday in the critical swing state, which the NAACP has previously sued over other voter access issues.

The voters' names were removed through challenges filed by activists, which the NAACP said was illegal because of the proximity to the election. Challengers in Moore and Cumberland counties include volunteers with the Voter Integrity Project, a group that says it aims to guard against voter fraud.

But Biggs took issue with the process in her ruling.

"Voter enfranchisement cannot be sacrificed when citizens through no fault of their own have been removed from the voter rolls," she said. "Moreover, electoral integrity is enhanced, not diminished, when all citizens who are eligible to vote are allowed to exercise that right free from interference and burden unnecessarily imposed by others."

State Board of Elections spokesman Pat Gannon said the board is "working quickly to establish the procedures necessary to fully comply with the court order." However, board attorney Josh Lawson said the state has not yet decided whether it will appeal facets of the ruling, potentially after the election.

The Rev. William Barber, president of the state NAACP, said the judge's decision "will help make sure not a single voter's voice is unlawfully taken away." The group, he added, "will not back down and allow this suppression to continue."

State elections officials said earlier this week that their database shows eight counties removed nearly 6,700 challenged voters statewide in the past two years. The state said Cumberland County removed the most — nearly 5,600 — and currently has about 200,000 registered voters. Moore County removed 790 of about 65,000 total voters. Beaufort removed 63 in the two-year period.

In most cases cited by the lawsuit, mail to a voter has been returned as undeliverable, which county boards can accept as evidence that the voter doesn't live there.

Under state law, any voter can challenge another county resident's registration, resulting in a hearing at which the challenger presents evidence, according to a state legal filing. If local officials find probable cause, the challenged voter is given notice of a subsequent hearing. A voter who doesn't rebut the evidence can be removed.

During the emergency hearing Wednesday, Biggs described the process as antiquated and "insane."

In her ruling Friday, she noted that "in all three counties, a few individuals submitted mailings marked undeliverable to the County Boards, sometimes in batches up to hundreds at a time."

Biggs said she was limiting Friday's preliminary injunction to the three cited in the lawsuit because she didn't have enough evidence on the others.

The State Board of Elections sent guidance to all counties late Friday noting that although the restoration of challenged voters applies only to Beaufort, Cumberland and Moore counties, no county board of elections may consider residency challenges before Election Day.

Voter Integrity Project of North Carolina Executive Director Jay DeLancy said late Friday he wasn't surprised by the ruling but said "the state did nothing wrong with following the (state) law. We did nothing wrong in following the law."

He hopes the federal voting rules that Biggs cited in her ruling are ultimately challenged.

DeLancy said the group partly wanted to draw attention to local voter rolls bloated with names of people no longer living in counties, leading to greater risk for someone to use another person's identity to vote.

The NAACP lawsuit comes during a protracted battle over voter access in the state. In July, a federal court struck down much of a 2013 elections law, saying the GOP-controlled General Assembly had disproportionately targeted black voters. The ruling lengthened in-person early voting by a week and eliminated a provision requiring photo ID for in-person voting.

That ruling sparked disagreements among local Democratic and Republican election officials about the number of sites and hours for early voting.