Chris Keane/Reuters Voters stand in line during early voting at the Beatties Ford Library in Charlotte, North Carolina.

WASHINGTON ― County election boards in North Carolina must restore the registrations of voters removed from the polls, U.S. District Judge Loretta Biggs ordered on Friday.

The order follows an emergency hearing held on Wednesday to address allegations that election officials in Beaufort, Moore and Cumberland counties had removed voters from the rolls due to campaign mailers that were returned as undeliverable.

The North Carolina NAACP sued the state on Monday, claiming the purge targeted black voters. The Justice Department submitted a statement of interest in the lawsuit on Monday night supporting the assertion that removing voters from the rolls en masse is a violation of the National Voter Registration Act.

Biggs, who during the hearing called the state’s process for removing voters’ names “insane,” said in her ruling that the NC NAACP had proved that names were unfairly removed.

“The Court finds that a narrowly tailored injunction is warranted to ensure that eligible voters are not deprived of their right to participate in the upcoming election due to a flawed process engaged in by the State and County Boards, which this Court has determined likely violates the NVRA,” Biggs said in her decision.

“Voter enfranchisement cannot be sacrificed when citizens through no fault of their own have been removed from the voter rolls,” she added.

Rev. William Barber, the president of the NC NAACP, said the court ruled against “surgical, intention racism.”

“Racism is about policy,” Barber said on a call with reporters. “It’s not just about feelings, it’s not just about language. It’s when you use your power ― or attempt to use your power ― to undermine the rights of people and you target it toward African-Americans.”

The civil rights group argues that these cancellations are an attempt by the Republican Party to suppress the black vote, which is lower this year than it was in 2012.

At least 5,600 registrations have been removed in Cumberland County for varying reasons since 2014, while 790 and 63 were removed in Moore and Beaufort counties, respectively.

At least 3,500 voters were removed in the past 90 days, according to Penda Hair, an attorney representing the NAACP. The cancellations could have cost Democratic presidential candidate Hillary Clinton the election, since most of the voters are black and tend to lean Democrat.

It’s still unclear whether or not those people will be able to vote on Election Day.

State law mandates that voters within any given county can challenge the eligibility of another voter in that county up to 25 days before the election.

But the National Voter Registration Act says states can only cancel registrations if a voter provides written notice of a change in address or if a voter does not respond to a notice for two election cycles and fails to vote for two federal election cycles. States also cannot remove voters from the rolls 90 days or less before a federal election.

“What they’re doing is race-driven. It’s immoral, illegal and it is unconstitutional. The courts have spoken,” Barber said. “We’ve not seen this kind of intentional suppression since the days of Jim Crow.”

Read Biggs’ decision in full:

HUFFPOST READERS: What’s happening in your state or district? The Huffington Post wants to know about all the campaign ads, mailers, robocalls, candidate appearances and other interesting campaign news happening by you. Email any tips, videos, audio files or photos to scoops@huffingtonpost.com.

