RALEIGH, N.C. (AP) — A federal appeals court has ruled that a North Carolina law that made it a crime for felony offenders who vote before they have completed their sentences without knowing they were breaking the law is unconstitutional.

A panel of the 4th U.S. Circuit Court of Appeals on Friday unanimously upheld a trial judge’s decision that found the law was discriminatory and harmed Black ex-defendants disproportionately.

At issue was a law against voting by felony offenders who were still serving sentences. In 2023, lawmakers updated the law so that, starting in January 2024, a person convicted of a felony had to know it was against the law to vote for it to be considered a crime.

But the old law wasn’t repealed and became the focus of the lawsuit originally filed in 2020. The plaintiffs — groups representing poor residents and Black union members — said that people could still be subject to prosecution for voting before 2024 under the old rules.

Melvin Montford, executive director of the North Carolina A. Phillip Randolph Institute, praised the ruling, saying it confirms “that this law was born out of racism and has been wielded to intimidate and disenfranchise Black voters.”