A pile of government pamphlets explaining North Carolina's controversial "Voter ID" law sits on table at a polling station as the law goes into effect for the state's presidential primary in Charlotte, North Carolina, U.S. on March 15, 2016. REUTERS/Chris Keane/File Photo

A federal appeals court on Friday struck down a North Carolina law that required voters to show photo identification when casting ballots, ruling that it intentionally discriminated against African-American residents.

The ruling is likely to be seen as a boost for Democratic presidential nominee Hillary Clinton going into November’s election. The state is politically important as it does not lean heavily toward either Democrats or Republicans, and Clinton is heavily favored among black Americans over Republican nominee Donald Trump.

The court’s decision also canceled provisions of the law that scaled back early voting, prevented residents from registering and voting on the same day, and eliminated the ability of voters to vote outside their assigned precinct.

Critics argue that voting laws enacted by North Carolina and several other states are designed to drive down turnout by minorities and poor people who rely more on flexible voting methods and are less likely to possess state-issued photo IDs.

In its ruling, a three-judge panel at the U.S. Appeals Court for the Fourth Circuit said the state legislature targeted African-Americans “with almost surgical precision.”

“We cannot ignore the recent evidence that, because of race, the legislature enacted one of the largest restrictions of the franchise in modern North Carolina history,” Judge Diana Motz wrote.

Lawyers for the state of North Carolina could not immediately be reached for comment. Backers of the law say it was meant to prevent voter fraud.

If the state chooses to appeal the decision, it could request another hearing of the case before all judges at the Fourth Circuit Court. But the chances of that happening before the Nov. 8 election appear slim.

Voting rights advocates heralded the decision as a major victory.

“This ruling is a stinging rebuke of the state’s attempt to undermine African-American voter participation, which had surged over the last decade,” Dale Ho, director of the Voting Rights Project at the American Civil Liberties Union, said in a statement. The ACLU was one of the groups that challenged the law in court.

North Carolina’s legislature passed the voting law weeks after the U.S. Supreme Court voted 5 to 4 in June 2013 to eliminate a requirement that states with a history of discrimination, including North Carolina, receive federal approval before changing election laws.

A Reuters review of the law indicated that as many as 29,000 voters might not have been counted in this November’s election if the bans on same-day registration and out-of-precinct voting had remained in effect.

(Additional reporting by Colleen Jenkins in Winston-Salem, N.C.; Editing by Frances Kerry)