A deeply divided Supreme Court has ruled 5-4 that Ohio’s plan to purge voters from the state’s election rolls does not violate established laws. Under the plan in Ohio, the state would be purging voters who failed to vote for six years and did not confirm their residency. Ohio currently has the strictest such law in the nation.

Federal laws enacted in 1993 and 2002 prevented states from removing voters from registration lists because of their failure to vote. However, they did allow for the voters to be removed from the rolls if they failed to respond to confirmation notices. The question before the court was whether failing to vote could be the initial trigger leading to removal.

Ohio has removed thousands of people from the voter registration rolls who didn’t vote for two years, didn’t return warning notices, then didn’t vote for an additional four years. The case came about when Larry Harmon challenged the process after he opted not to vote in 2009 and 2010. In 2015, he was told his registration had been canceled when he showed up at the polls. He claimed no recollection of receiving a confirmation notice from the state.

Justice Samuel Alito said in his majority opinion that failing to vote cannot be the sole reason for purging voters, but Ohio “removes registrants only if they have failed to vote and have failed to respond to a notice.” The ruling protects similar laws in six states: Pennsylvania, Georgia, Oregon, Oklahoma, West Virginia, and Montana. Ohio Secretary of State Jon Husted called the ruling “a victory for election integrity and a defeat for those who use the federal court system to make election law across the country.”

Civil rights groups had challenged Ohio’s procedure, arguing that it disproportionately affects minorities, the poor and people with disabilities. In an 18-page dissent, Justice Stephen Breyer wrote that Ohio’s process “erects needless hurdles to voting of the kind Congress sought to eliminate.” Justice Sonia Sotomayor noted in a separate dissent that Ohio statistics show the state’s process disproportionately affects minority, low-income, disabled, and veteran voters.

The ruling comes as the country gears up for midterm elections this fall. Many think that the decision probably will help Republicans and hurt Democrats. Republicans tend to benefit from lower voter turnout, while Democrats do best in high-turnout elections. Most of the states that backed Ohio have Republican governors or legislatures; most of those opposed are governed by Democrats.