— A federal appeals court ruled Friday that state lawmakers adopted a photo identification requirement for voters and other changes to state elections laws "with discriminatory intent" and ordered that the changes be blocked.

Immediately after lawmakers passed the Voter Information and Verification Act in 2013, the state NAACP, the League of Women Voters, other advocacy groups and several voters challenged the voter ID requirement and other provisions, including reducing the early voting period, eliminating same-day registration and voiding ballots cast in the wrong precinct. The U.S. Department of Justice later joined in the lawsuit.

The voter ID requirement took effect with the March primary, but courts have put the same-day registration and out-of-precinct voting provisions on hold pending the outcome of the lawsuits.

Voter ID opponents hailed the ruling as a victory for North Carolina voters.

"The ability of Americans to have a voice in the direction of their country – to have a fair and free opportunity to help write the story of this nation – is fundamental to who we are and who we aspire to be," U.S. Attorney General Loretta Lynch said in a statement.

"We are happy today that the 4th Circuit Court of Appeals' decision exposed the racist intent of the extremist element of our government in North Carolina," Rev. William Barber, state president of the NAACP, said in a statement. "We know that this decision is a step closer to a freer, fairer electoral system in our state and in the nation."

"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 ACLU's Voting Rights Project, said in a statement. "It is a major victory for North Carolina voters and for voting rights."

"We applaud the appeals court for recognizing the discriminatory intent behind the monster voter suppression law," Bob Hall, executive director of Democracy North Carolina, said in a statement. "The ruling makes clear that the North Carolina General Assembly cherry-picked its revisions in the law to suppress African American and young voters. Today’s ruling begins to right that wrong."

Gov. Pat McCrory, House Speaker Tim Moore and Senate President Pro Tem Phil Berger said they would appeal the ruling to the U.S. Supreme Court.

"Photo IDs are required to purchase Sudafed, cash a check, board an airplane or enter a federal court room. Yet, three Democratic judges are undermining the integrity of our elections while also maligning our state," McCrory said in a statement.

"Since today’s decision by three partisan Democrats ignores legal precedent, ignores the fact that other federal courts have used North Carolina's law as a model and ignores the fact that a majority of other states have similar protections in place, we can only wonder if the intent is to reopen the door for voter fraud, potentially allowing fellow Democrat politicians like Hillary Clinton and Roy Cooper to steal the election," Moore and Berger said in a joint statement.

Dallas Woodhouse, executive director of the North Carolina Republican Party, also assigned a partisan motive to the ruling, suggesting Attorney General Roy Cooper, the Democratic candidate for governor, didn't defend the law properly.

"This is an effort to overthrow the will of the people on voter ID and ballot security, and it is led by the Democrats and, we believe, by Roy Cooper, who did a really lackluster job of defending voter ID while at the same time publicly criticizing it," Woodhouse said.

A spokesman for Cooper's campaign said Cooper had advised McCrory in 2013 to veto VIVA, as it was likely unconstitutional. Yet, the Attorney General's Office has defended the law in both state and federal courts.

Kim Strach, executive director of the State Board of Elections, said her agency will continue trying to educate voters and prepare for the November elections, regardless of whether IDs will be needed at the polls. She also urged voters to vote early or show up at the right precinct on Election Day to avoid any problems.

Court: Changes based on race

U.S. District Judge Thomas Schroeder upheld VIVA in April, saying the plaintiffs didn't demonstrate the law violated the Voting Rights Act or the equal protection guarantees in the Constitution. But the 4th U.S. Circuit Court of Appeals said Schroeder ignored "critical facts bearing on legislative intent, including the inextricable link between race and politics in North Carolina."

"In North Carolina, restriction of voting mechanisms and procedures that most heavily affect African Americans will predictably redound to the benefit of one political party and to the disadvantage of the other. As the evidence in the record makes clear, that is what happened here," Judge Diana Gribbon Motz wrote for the unanimous three-judge panel.

The judges noted that, before passing VIVA, state lawmakers obtained data broken down by race on the use of various voting practices, such as early voting and same-day registration, and used the law to target those practices to target black voters "with almost surgical precision."

"Using race as a proxy for party may be an effective way to win an election. But intentionally targeting a particular race’s access to the franchise because its members vote for a particular party, in a predictable manner, constitutes discriminatory purpose," Motz wrote. "A state legislature acting on such a motivation engages in intentional racial discrimination in violation of the Fourteenth Amendment and the Voting Rights Act."

State lawmakers have argued that VIVA is necessary to combat voter fraud and that growing numbers of black voters in North Carolina demonstrate that the law doesn't infringe on their rights. The 4th Circuit judges dismissed both arguments.

"The photo ID requirement here is both too restrictive and not restrictive enough to effectively prevent voter fraud," Motz wrote, noting that the provision doesn't address potential fraud in mail-in absentee voting and needlessly limits the types of state-issued IDs that are acceptable at the polls.

The judges likewise dismissed the state's justifications for eliminating same-day registration and cutting a week from the early voting period.

VIVA was unveiled in the wake of a U.S. Supreme Court ruling that said Southern states no longer needed federal approval of changes to their election laws. North Carolina lawmakers passed it along party lines without any public hearings and with limited debate in the House and the Senate.

"Neither this legislature – nor, as far as we can tell, any other legislature in the Country – has ever done so much, so fast, to restrict access to the (voting) franchise," Motz wrote.

The court split 2-1 on whether the General Assembly's softening of the voter ID requirement last year should be weighed before ordering that the provision be immediately overturned.

Lawmakers allowed voters who had "reasonable impediment" to obtaining an ID, such as a health issue or lack of transportation, to sign an affidavit and still be able to cast a ballot.

"Even if the State were able to demonstrate that the amendment lessens the discriminatory effect of the photo ID requirement, it would not relieve us of our obligation to grant a complete remedy in this case," Judge James Wynn wrote for the majority, saying that the provision must be thrown out because it was "motivated by an impermissible discriminatory intent."