North Carolina’s Republican-controlled legislature rewrote the state’s voting rules in 2013 shortly after the Supreme Court struck down a section of the Voting Rights Act of 1965 that had given the Justice Department the power to oversee changes in election procedures in areas with a history of racial discrimination. Forty of the state’s 100 counties had been subject to oversight.

Civil rights advocates and the Justice Department had sued to block the law, but a Federal District Court judge upheld it in April, writing that the state’s “significant, shameful past discrimination” had largely abated in the last 25 years.

On Friday, the three-judge panel emphatically disagreed, saying the lower court’s amply documented ruling had failed to consider “the inextricable link between race and politics in North Carolina.”

The judges noted that Republican leaders had drafted their restrictions on voting only after receiving data indicating that African-Americans would be the voters most significantly affected by them.

“We cannot ignore the record evidence that, because of race, the legislature enacted one of the largest restrictions of the franchise in modern North Carolina history,” they wrote. “The court seems to have missed the forest in carefully surveying the many trees,” they stated. The panel stopped short of reimposing federal oversight on the state’s elections, saying that striking down the law was enough.

Voting rights advocates called the ruling, which Republicans say they will appeal, a resounding victory. Fresh from speaking Thursday night at the Democratic National Convention, the Rev. William J. Barber II, the president of the North Carolina branch of the N.A.A.C.P., which is a plaintiff in the lawsuit, called the decision “a moral and constitutional vindication of our constitutional critique of this extremist legislature and our extremist governor.

“A political majority doesn’t give you the power to run roughshod over the Constitution,” he said.

Attorney General Loretta E. Lynch, who was in Baton Rouge, La., on Friday, also welcomed the decision, saying the law “sent a message that contradicted some of the most basic principles of our democracy.