The ruling could affect thousands of voters.
"The court concludes 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," wrote Loretta Biggs of the US District Court for the Middle District of North Carolina.
Kim Westbrook Strach, the executive director of the North Carolina State Board of Elections, issued a statement Friday afternoon saying her office "is working quickly to establish the procedures necessary to comply with the court order between now and Election Day."
Civil Rights groups praised the ruling that comes in a the key swing state just four days before Election Day.
"The judge's order today ensures that voters improperly challenged in three North Carolina counties will be restored to the voter rolls before Election Day," said Allison Riggs, Senior Attorney for the Southern Coalition for Social Justice.
Lawyers for the civil rights group argued that boards of elections in Beaufort, Moore and Cumberland counties had canceled thousands of voter registrations after a small number of individuals challenged the registration of approximately 4,500 voters based "exclusively on mass mailings that were returned as undeliverable."
They argued the "en masse" cancellation was done in violation of the National Voter Registration Act that prohibits systemic voter removal programs within 90 days of a federal election and that it disproportionately targeted African-American voters.
"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," Biggs wrote.
One plaintiff, James Edward Arthur Sr., said that he had planned to vote but recently learned that his voter registration was canceled, "as a result of a third-party challenge brought under North Carolina's voter challenge statute." Grace Bell Hardison, a 100-year-old African-American woman living in Beaufort County is another plaintiff. In court papers the NAACP argued that she has voted in nearly every election for the last 12 years but recently learned that her registration was challenged based on an alleged change of residence -- even though she hasn't moved since 2011. Her nephew was "ultimately successful" in presenting evidence of her residence.
The NAACP alleged the purge was done after first-class mail to the voter at the address listed on the voter registration card was returned.
"In many cases, voters purged by defendants still reside at the address where they are registered to vote, or have moved within the county and remain eligible to vote there," NAACP lawyers argued. "Nonetheless, a single item of returned mail has resulted in their ultimate removal from the voter rolls."
The Justice Department had weighed in on the case, telling the judge in court briefs that if the allegations made by the plaintiffs were true "safeguards" were absent and federal law was violated.
Kimberly Westbrook Strach, executive director of the North Carolina State Board of Elections, says that the challenges at issue were not initiated with the counties, but by private individuals.
Under North Carolina law any voter in a county can challenge the eligibility of any other county voter up to 25 days before the election. The challenge can include a residency challenge.
Strach addressed the controversy in a letter sent last week to Dr. William J. Barber II, president of the North Carolina State Conference of the NAACP. "A challenge validly entered will trigger a preliminary hearing, written notice to the affected voter and a full hearing on the merits before the appointed members of the county board of elections."
She said that in all the cases "county officials indicate that their respective boards of elections held preliminary hearings, notified the challenged voters by mail, and held hearings on the merits."
In the letter Strach emphasized that while the federal law prohibits a state from "conducting systematic list maintenance within 90 days of a federal election," the challenges involved in the case come from private citizens and were resolved through a "statutory process that ensures notice and an opportunity to be heard before the appropriate body within the county."
In a statement after the lawsuit was filed she said, "the statutes at issue are decades old and are common across the country and widely regarded as compatible with the National Voter Registration Act. If the plaintiffs are right, then most states are wrong."
After the hearing, and even before the opinion was released, Strach issued a statement saying that, "As the independent agency that administers elections in North Carolina, we will comply with any court order."
This story has been updated.