A federal appeals court Wednesday upheld North Carolina’s law requiring voters to present photo identification before casting ballots, even as it acknowledged the state’s “long and shameful history of race-based voter suppression.”

A unanimous three-judge panel of the U.S. Court of Appeals for the 4th Circuit said North Carolina’s past practice does not indefinitely prevent the state from enacting new voting restrictions.

The panel said a lower-court judge had improperly considered the state’s “past conduct to bear so heavily on its later acts that it was virtually impossible for it to pass a voter-ID law that meets constitutional muster,” according to the opinion from Judge Julius N. Richardson, who was nominated by President Trump.

Richardson was joined by Judges A. Marvin Quattlebaum Jr., also a Trump nominee, and Pamela A. Harris, a nominee of President Barack Obama.

The 4th Circuit’s ruling reverses a district-court decision that said North Carolina’s 2018 photo ID law would probably have a disproportionate effect on African America voters in the state. The identification requirement had been blocked by federal and state judges, and it did not apply in the November election in which Trump won North Carolina.

The law remains blocked while the separate state case is pending; the federal litigation will also continue.

The federal lawsuit, brought by the North Carolina State Conference of the NAACP, is the latest North Carolina election measure scrutinized in court. The law was passed after the 4th Circuit struck down a separate set of voting rules that the court said in 2016 deliberately undercut the political power of Black voters and would “target African Americans with almost surgical precision.”

T. Anthony Spearman, president of the NC NAACP, said in a statement after the ruling that his organization would continue to “challenge every barrier placed deliberately in the path of the people of North Carolina to express our fundamental right to the ballot. This is a moral and legal imperative for us, and it is an evergreen priority.”

In its 29-page ruling, the appeals court said Wednesday that the district court failed to give lawmakers behind the new photo ID law the benefit of the doubt and did not provide “the presumption of legislative good faith” as the Supreme Court has required.

“The district court penalized the General Assembly because of who they were, instead of what they did,” Richardson wrote.

The 2018 law was enacted after a supermajority of the legislature overrode the governor’s veto. North Carolina voters also approved a ballot measure creating a constitutional requirement that voters present a photo ID.

Attorneys defending the law told the court that the law ensures registered voters without proper identification can cast provisional ballots and that free, no-documentation-required IDs are available through the state.

On the other side, Gov. Roy Cooper (D) had urged the judges to prevent the measure, known as S.B. 824, from taking effect. He said the law would disenfranchise minority voters, who are less likely to possess the required identification.

But the court found that the 2018 law is “more protective of the right to vote” than other states’ voter ID laws that courts have approved, including in Virginia and South Carolina.

“We cannot agree that the Challengers would likely carry their burden of proving that the General Assembly acted with discriminatory intent in passing the 2018 Voter-ID Law,” the court said.

Cooper’s press secretary Dory MacMillan said in an email that the governor’s office is reviewing the ruling and that Cooper “has been clear in his opposition to unnecessary barriers intended to restrict access to the ballot box.”

State House Speaker Tim Moore (R), a sponsor of the constitutional amendment, said in a statement Wednesday, “Now that a federal appeals court has approved North Carolina’s voter ID law and constitutional amendment, they must be implemented for the next election cycle in our state.”

Eighteen states ask for a photo ID to cast ballots, according to the National Conference of State Legislatures. Seventeen other states also accept non-photo identification such as a bank statement with a name and address.