(Reuters) - A federal judge in Ohio laid out a plan on Wednesday for the state to restore voting privileges for people who were illegally removed from the state’s voter rolls over the past five years.

The ruling stems from a case in which the ACLU and other plaintiffs sued, saying Ohio’s process for removing people who had died or moved away from voter rolls was illegal because it purged people simply for not voting and not responding to a letter from the state.

Voting rights cases have become pivotal battlegrounds ahead of the Nov. 8 election between Democrat Hillary Clinton and Republican Donald Trump.

The American Civil Liberties Union and others have challenged laws in Wisconsin, Michigan and North Carolina over voting rights issues.

In the Ohio case, the 6th U.S. Circuit Court of Appeals in Cincinnati said Ohio’s process for removing inactive voters was illegal, reversing an earlier ruling by U.S. District Judge George C. Smith.

In response, Smith on Wednesday ordered the state to allow people who had been removed from the rolls to cast provisional ballots on election day.

Those ballots will be checked against voter rolls, and if people were purged in the years 2011, 2013 or 2015, their votes will be counted and their registration restored.

“They’ll have to put a provisional ballot which will take a little more time but if they do that, that vote will count,” said Stuart Naifeh, an attorney with Demos, a voter rights and income inequality advocacy group that was among those suing over the policy.

Joshua Eck, a spokesman for Ohio Secretary of State Jon Husted, said the solution was a workable one because it did not require the wholesale restoration of voting privileges to people who had moved away, died or otherwise become ineligible to vote.

(Reporting by Sharon Bernstein in Sacramento, Calif.; Editing by Peter Cooney)