Updated

The Supreme Court ruled Monday that Ohio is allowed to purge eligible voters from the state’s registration records if they have not cast ballots in a while.

In a 5-4 ruling issued by Justice Samuel Alito, the high court ruled that Ohio’s law to trigger the removal of inactive voters from the state’s registry can be enforced.

State officials argued that the process used by Ohio for more than 20 years is constitutional and legal, and meant to ensure election security.

Civil liberties groups challenged the state’s program for removing thousands of people from voter rolls based on their failure to vote in recent elections, claiming it violated the National Voter Registration Act.

'The only question before us is whether it violates federal law. It does not.'

— Justice Samuel Alito, on Ohio's voter roll purge

But Alito said that Ohio is complying with the National Voter Registration Act of 1993. At least six other states have similar rules in place, and Monday's decision could lead others to adopt similar procedures.

“It is undisputed that Ohio does not remove a registrant on change-of-residence grounds unless the registrant is sent and fails to mail back a return card and then fails to vote for an additional four years,” Alito wrote in his opinion.

He concluded: "We have no authority to second-guess Congress or to decide whether Ohio’s Supplemental Process is the ideal method for keeping its voting rolls up to date. The only question before us is whether it violates federal law. It does not."

Under Ohio rules, registered voters who fail to vote in a two-year period are targeted for eventual removal from voter rolls, even if they haven’t moved and still remain eligible. The state says it removes names from registration only after local election boards send notices, and if there is no voting activity for the next four years.

The state first compares its voter rolls to the U.S. postal service list of people who have reported a change in address. Some residents, though, move without notifying the post office of a change in address.

Ohio has used voter inactivity to remove people from the registration since 1994.

Alito, in his opinion, clarified that states could not use the failure to vote as the sole reason for removal from the register. Officials would be required to show someone had changed their residence, was incarcerated or met other criteria.

Alito also cited statistics that 24 million voter registrations—about one in eight—are “either invalid or significantly inaccurate,” and that about 2.75 million people “are said to be registered to vote on more than one state.”

His opinion was supported by Chief Justice John Roberts and Justices Anthony Kennedy, Clarence Thomas and Neil Gorsuch.

The Trump administration backed the state.

But the four liberal justices dissented.

Justice Sonia Sotomayor said the ruling would hamper the right to vote in many parts of the country.

“Our democracy rests on the ability of all individuals, regardless of race, income, or status, to exercise their right to vote,” she said. “Communities that are disproportionately affected by unnecessarily harsh registration laws should not tolerate efforts to marginalize their influence in the political process, nor should allies who recognize blatant unfairness stand idly by.”

Sotomayor was joined by Justices Ruth Bader Ginsburg, Stephen Breyer and Elena Kagan.

Partisan fights over ballot access are being fought across the country. Democrats have accused Republicans of trying to suppress votes from minorities and poorer people who tend to vote for Democrats. Republicans have argued that they are trying to promote ballot integrity and prevent voter fraud.

The Associated Press contributed to this report.