Courts dealt setbacks to Republican efforts in three states to restrict voting, blocking a North Carolina law requiring photo identification, loosening a similar measure in Wisconsin and halting strict citizenship requirements in Kansas.

The rulings Friday came as the 2016 election moves into its final phase, with Republican Donald Trump and Democrat Hillary Clinton locked in a high-stakes presidential race and control of the U.S. Senate possibly hanging in the balance. North Carolina is one of about a dozen swing states in the presidential race, while Wisconsin has voted Democratic in recent presidential elections and Kansas has been solidly Republican.

The decisions followed a similar blow earlier this month to what critics said was one of the nation's most restrictive voting laws in Texas. The New Orleans-based U.S. 5th Circuit Court of Appeals said Texas' voter ID law is discriminatory and must be weakened before the November election.

On Friday, a three-judge panel of the Virginia-based 4th Circuit Court of Appeals blocked North Carolina's law that limited to six the number of acceptable photo IDs. The law also curtailed early voting and eliminated same-day registration.

The court said the North Carolina provisions targeted African Americans with "almost surgical precision."

Critics of photo ID requirements say they fall disproportionately on minority voters and the poor, who are less likely to have an ID such as a driver's license and tend to vote Democratic. Supporters say they photo IDs are needed to combat voter fraud.

Election-law expert Richard Hasen of the University of California at Irvine said the Obama administration took on the North Carolina and Texas cases as a bulwark against voting restrictions.

"If North Carolina and Texas could get away with these voting restrictions, it would have been a green light for other states to do so," he said. "I think this is a hugely important decision."

In the Kansas ruling, a county judge said the state must count thousands of votes in local and state elections from people who did not provide proof of U.S. citizenship when they registered. Kansas Secretary of State Kris Kobach, a national leader in Republican voter restriction efforts, had pushed through a rule that would have set those votes aside, perhaps up to 50,000 by the November election.

The Kansas ruling just four days before the state primary election means that about 17,000 voters will have their ballots counted in races for the state Legislature and other local contests.

Kobach said the decision would allow people living in the U.S. illegally to vote, although voting rights advocates say there have been few cases of voter fraud in the past.

In Wisconsin, a federal judge threw out a host of election laws, while allowing the state's voter ID law to remain in place with substantial limitations. U.S. District Judge James Peterson ordered the state to quickly issue credentials valid for voting to anyone trying to obtain a free photo ID but lacking underlying documents such as birth certificates.

He struck down restrictions on absentee and early voting, saying they discriminated against blacks. He also struck down an increase in residency requirements from 10 to 28 days, a prohibition on using expired but otherwise qualifying student IDs to vote and a prohibition on distributing absentee ballots by fax or email.

Marc Elias, an attorney whose law firm has challenged voting restrictions in several states including Wisconsin and North Carolina, said the recent rulings are steps toward correcting "voting restriction laws put in place by Republican legislators." There's been a concerted effort by Republicans nationwide since President Barack Obama was elected to peel back voting rights and laws improving access to the polls that had been in place since the Civil Rights era of the 1960s, he said.