A panel of federal judges on Friday ruled that South Carolina lawmakers racially gerrymandered the state’s 1st Congressional District specifically to dilute the power of Black voters.

Three Democratic-appointed judges, who heard the case in South Carolina’s federal district court, found that state lawmakers’ shifting some 30,000 African Americans in Charleston County to a nearby district “was more than a coincidence” and violated the 14th Amendment based on Supreme Court precedent.

“After carefully weighing the totality of evidence in the record and credibility of witnesses, the Court finds that race was the predominant motivating factor in the General Assembly’s design of Congressional District No. 1 and that traditional districting principles were subordinated to race,” the judges ruled.

The court gave the lawmakers until March 31 to submit a new map and prevented further elections in the district until the new boundaries are approved.

The longtime Republican district, which runs along much of South Carolina’s coast, had in a major upset elected former Rep. Joe Cunningham (D) in 2018. Two years later, Rep. Nancy Mace (R) narrowly defeated Cunningham by 1.3 percentage points.

After the district lines were redrawn, she won on a more comfortable margin of nearly 14 percentage points this past November.

A resident of the district and the NAACP’s South Carolina wing challenged the new maps, also bringing claims of racial gerrymandering in two other congressional districts that were thrown out by the judges.

But the court ultimately sided with the resident and NAACP in some of its claims about the 1st District. They had also made allegations about the district’s boundaries in other counties, but the judges dismissed those claims.

“For decades, South Carolina has tried to push Black voters out of the electoral process and effectively silence us with maps that dilute our political power,” Taiwan Scott, the resident who filed the case, said in a statement. “Today’s decision finally recognizes this egregious, generations-long effort to box us out of representation. While there is still a lot of work to be done, we are one step closer to rectifying South Carolina’s long history of voter suppression, and one step closer to the representation we deserve.”

Brenda Murphy, the president of the South Carolina State Conference of the NAACP, called the decision a “crucial win.”

“With this order and its call for barring all future congressional elections in CD 1 and ordering the General Assembly to submit a remedial map, we are emboldened and encouraged that we will see fairer congressional maps for South Carolina,” she said.