 -- Just weeks before the Nov. 8 election, a federal appeals court has ruled that Ohio’s method of purging names of inactive voters from voter rolls is unconstitutional.

Ohio, a battleground state in the presidential race, removed the names of tens of thousands of registered voters under what it calls its “supplemental process."

Under this controversial method, voters were taken off the registration rolls after six years of not voting, regardless of whether they remained eligible to vote.

As ABC News reported in June, many of those removed were from low-income neighborhoods or neighborhoods that tended to vote Democrat.

Voting-rights activists argued that this method of removing voters directly violates the National Voter Registration Act, which says states can only remove voters from the rolls if they request it, die or move.

Ohio's top elections official, Secretary of State Jon Husted, defended the practice as necessary to keep registration rolls up to date and to prevent fraud.

Public policy organization Demos and the ACLU of Ohio filed a federal lawsuit against Husted, asking that the court halt the purging process and reinstate voters' names that had been purged. The suit alleged that a much larger number of infrequent Ohio voters are expected in this year's contentious presidential election. Advocates claimed that these voters would be "denied the opportunity to cast a vote that counts."

On Friday, the Sixth Circuit Court of Appeals sided with the plaintiffs, reversing a lower court decision in favor of Husted. The appeals court remanded the case to the district court to design a remedy.

The ACLU of Ohio celebrated the victory, voicing optimism that those purged will be able to cast their ballots in this swing state come November.

“We don’t believe that any voters should be removed from the rolls simply because they haven’t voted in a few elections,” Mike Brickner, senior policy director at the ACLU's Ohio chapter, said in a statement. “We hope that a plan will emerge soon to allow the tens of thousands of voters illegally purged from the rolls to vote in the upcoming presidential election,”

Husted expressed frustration at a ruling that he said interfered with longstanding state practice, and he vowed to appeal if whatever new rules are put in place reinstate the names of voters who have died or moved out of state.

"This ruling overturns 20 years of Ohio law and practice, which has been carried out by the last four secretaries of state, both Democrat and Republican," the Ohio secretary of state said in a statement. “It is one thing to strike down a longstanding procedure; it is another to craft a workable remedy. To that end, if the final resolution requires us to reinstate voting eligibility to individuals who have died or moved out of Ohio, we will appeal.”

ABC News' Mariam Khan contributed this report.