A federal judge on Friday struck down a string of Wisconsin voting restrictions passed by the Republican-led legislature and ordered the state to revamp its voter identification rules, finding that they disenfranchised minority voters.

U.S. District Judge James Peterson, ruling in a legal challenge to the laws by two liberal groups, said he could not overturn the entire voter ID law because a federal appeals court had already found such restrictions to be constitutional.

But Peterson, in his 119-page ruling, said the requirements that Wisconsin voters show either a photo identification or go through a special petition process had unfairly burdened minorities and needed to be reformed or replaced before the November presidential election.

“To put it bluntly, Wisconsin’s strict version of voter ID law is a cure worse than the disease,” the judge wrote.

Peterson left the voting rules intact for the Aug 9. primary elections for federal, state and local offices, saying to change them less than two weeks in advance would be disruptive.

But his ruling was expected to impact the November presidential election in Wisconsin, which could prove a crucial battleground state for Democrat Hillary Clinton and Republican Donald Trump.

Peterson also struck down as unconstitutional limits on in-person absentee voting, residency requirements and a ban on using expired student identification.

Wisconsin Governor Scott Walker said in a tweet that he was “disappointed in the decision by an activist federal judge” and expected to file an appeal.

A spokesman for One Wisconsin Institute, one of the two groups which filed the challenge, hailed Peterson’s ruling as “a huge win not only for the plaintiffs but for democracy itself.”

Wisconsin is one of several Republican-led states that have passed such voter ID laws in recent years amid fear of fraudulent voting by illegal immigrants and others.

Among the nine states with the strictest laws, insisting on state-issued photo identification for voters, are Georgia, Indiana, Texas and Virginia.

A U.S. appeals court judge earlier this month ruled the Texas law discriminatory. The judge sent the case back to the lower court to examine whether the law had a discriminatory purpose and also asked the court for a short-term fix for the November general election.

Republicans say voter ID laws are needed to prevent voter fraud. Democrats say the laws are really intended to make it harder for poor African-Americans and Latinos, who tend to vote Democrat, to vote.

(Reporting by Dan Whitcomb; Editing by James Dalgleish, Leslie Adler and Bernard Orr)