A federal appeals court ruled Friday against Ohio’s procedure for removing voters from state rolls, dealing a blow to Republican Secretary of State Jon Husted and handing a victory to voting rights advocates in a key presidential swing state.

A three-judge panel of the U.S. Court of Appeals for the 6th Circuit overruled a U.S. district court judge’s decision that Husted was not violating any laws with the process he was using to take inactive voters off the rolls if they did not confirm their status. By a ­2-to-1 vote, the court of appeals sent the case back to the district court.

The dispute centers on Ohio’s removal of possibly tens of thousands of voters from registration lists because they did not respond to letters seeking to confirm their addresses and have not cast a ballot since 2008, in what is being criticized as a “use it or lose it” rule for voting.

The appeals court ruled that Ohio’s practices could unjustifiably remove some eligible voters and are not in compliance with the National Voter Registration Act of 1993.

“A state cannot avoid the conclusion that its process results in removal ‘solely by reason of a failure to vote’ . . . by providing that the confirmation notice procedure is triggered by a registrant’s failure either to vote or to climb Mt. Everest or to hit a hole-in-one,” said the ruling.

In a statement, Husted said the court’s decision “will effectively force us to put voters back on the voter rolls who have died or long since moved to another address.” He said that if “the final resolution requires us to reinstate voting eligibility to individuals who have died or moved out of Ohio, we will appeal.”

Ohio Democratic Party Chairman David Pepper called Friday’s decision a “huge win for Ohio voters.”

“The court’s decision reaffirms a basic principle: voters shouldn’t lose their right to vote simply because they vote infrequently,” he said in a statement.

Both Democrat Hillary Clinton and Republican Donald Trump are heavily contesting Ohio. Polls show a close contest in the state, where 18 electoral votes are up for grabs. Trump campaigned in the state this week.

The current policy of mandating that inactive voters effectively prove that they still belong on the voter rolls appears to be aiding Republicans in Ohio’s largest metropolitan areas, according to a recent Reuters study. The study found that in Cleveland, Cincinnati and Columbus, voters have been taken off the rolls in ­Democratic-leaning areas at about twice the rate as in GOP-heavy areas.

The Ohio chapter of the A. Philip Randolph Institute and the Northeast Ohio Coalition for the Homeless, represented by the American Civil Liberties Union of Ohio and Demos, filed suit challenging the law in federal court.

In July, the Justice Department joined the court fight when it and the groups appealed the case to the U.S. Court of Appeals for the 6th Circuit after the district court upheld Husted’s decision.

Voting rights advocates have expressed deep concern about the policy. Some cite the 2000 election in Florida, when the state incorrectly stated that about 12,000 registered voters were ­ex-cons and then purged them from the rolls.

Republicans have expressed concern that changing the policy could lead to voter fraud. However, documented instances of fraud are rare. A 2014 study by Loyola Law School professor Justin ­Levitt found 31 incidents of voter impersonation out of more than a billion ballots cast.

Along with the dispute over the voter rolls, the Supreme Court this month rejected a request from Democrats in Ohio to restore an extra week of early voting. After voters faced long lines in 2004, the state had added the additional week, known as the Golden Week, because the days overlapped with the period for voter registration.

In 2013, a Republican-controlled legislature repealed the law. A federal judge found that action unconstitutional, but his decision was overturned by an appeals court, and the Supreme Court declined to intervene.

Judge Eric L. Clay, who was appointed by President Bill Clinton, delivered the Friday opinion. He was joined by Judge Julia Smith Gibbons, an appointee of President George W. Bush.

Judge Eugene E. Siler Jr. dissented in part and concurred in part. He was appointed by President George H.W. Bush.