WASHINGTON (AP) - States can target people who haven't cast ballots in a while in efforts to purge their voting rolls, the Supreme Court ruled Monday in a case that has drawn wide attention amid stark partisan divisions and the approach of the 2018 elections.

By a 5-4 vote that split the conservative and liberal justices, the court rejected arguments in a case from Ohio that the practice violates a federal law intended to increase the ranks of registered voters. A handful of other states also use voters' inactivity to trigger processes that could lead to their removal from the voting rolls.

Justice Samuel Alito said for the court that Ohio is complying with the 1993 National Voter Registration Act. He was joined by his four conservative colleagues in an opinion that drew praise from Republican officials and conservative scholars.

President Donald Trump hailed the ruling from Singapore on Tuesday, tweeting: "Just won big Supreme Court decision on Voting! Great News!"

The four liberal justices dissented, and civil rights groups and some Democrats warned that more Republican-led states could enact voter purges similar to Ohio's.

Ohio is of particular interest nationally because it is one of the larger swing states in the country with the potential to determine the outcome of presidential elections. But partisan fights over ballot access are playing out 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.

Ohio's contested voter purge stems from an inoffensive requirement in federal law that states have to make an effort to keep their voter rolls in good shape by removing people who have moved or died.

But Ohio pursues its goal more aggressively than most, relying on two things: voter inactivity over six years encompassing three federal elections and the failure to return a card, sent after the first missed election, asking people to confirm that they have not moved and continue to be eligible to vote.

Voters who return the card or show up to vote over the next four years after they receive it remain registered. If they do nothing, their names eventually fall off the list of registered voters.

The case hinged on a provision of the voter registration law that prohibits removing someone from the voting rolls "by reason of the person's failure to vote."

Alito said that the two factors show that Ohio "does not strike any registrant solely by reason of the failure to vote."

Justice Stephen Breyer, countered in his dissent: "In my view, Ohio's program does just that." Breyer said many people received mailings that they discard without looking at them. Failure to return the notice "shows nothing at all that is statutorily significant," he wrote.

In a separate dissent, Justice Sonia Sotomayor said Congress enacted the voter registration law "against the backdrop of substantial efforts by states to disenfranchise low-income and minority voters." The court's decision essentially endorses "the very purging that Congress expressly sought to protect against," Sotomayor wrote.

Richard Hasen, an election law expert at the University of California at Irvine, called the case "a close question of statutory interpretation." Hasen said the lawsuit the court resolved Monday did not involve allegations of discrimination against minority voters, and he suggested the laws in Ohio and other states could be vulnerable to a legal challenge on those grounds.

Civil rights groups said the court should be focused on making it easier for people to vote, not allowing states to put up roadblocks to casting ballots.

"With the midterm election season now underway, the court's ruling demands heightened levels of vigilance as we anticipate that officials will read this ruling as a green light for loosely purging the registration rolls in their community," said Kristen Clarke, president and executive director of the Lawyers' Committee for Civil Rights Under Law.

Ohio has used voters' inactivity to trigger the removal process since 1994, although groups representing voters did not sue the Republican secretary of state, Jon Husted, until 2016. As part of the lawsuit, a judge last year ordered the state to count 7,515 ballots cast by people whose names had been removed from the voter rolls.

Husted called the decision "a victory for electoral integrity." He is running for lieutenant governor this November on the Republican ticket headed by Mike DeWine, the current attorney general.

Adding to the tension in the case, the Trump administration reversed the position taken by the Obama administration and backed Ohio's method for purging voters.

Last week, Trump said he would nominate Eric Murphy, the Ohio lawyer who argued the case on the state's behalf, to a seat on the Cincinnati-based 6th U.S. Circuit Court of Appeals. A three-judge panel on that court had ruled 2-1 that Ohio's practice was illegal.

Copyright 2018 The Associated Press. All rights reserved.