(Reuters) - A federal judge on Friday struck down parts of a Wisconsin law requiring voters to show photo identification at the polls, as well as other election rules passed by the state's Republican-led legislature.

U.S. District Judge James Peterson, ruling in a lawsuit by two liberal groups that challenged the 2011 package of legislation, found some of the restrictions unconstitutional.

Peterson, in his 119-page ruling, recognized the state's ability to require a voter ID as part of its regulation of elections, but said that "parts of Wisconsin’s election regime fail to comply with the constitutional requirement that its elections remain fair and equally open to all qualified electors."

Peterson left the voting rules intact for the Aug 9. primary elections for federal, state and local offices, saying to change them now 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.

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 and Leslie Adler)