RICHMOND, Va. (AP) — A federal court on Tuesday ordered Virginia lawmakers to redraw the state’s electoral map after finding that 11 legislative districts were unconstitutionally gerrymandered.

The 2-1 ruling by a three-judge panel came in a 2014 lawsuit that accused lawmakers of illegally packing black voters into certain districts to make surrounding districts whiter and more Republican.

“Overwhelming evidence in this case shows that, contrary to this constitutional mandate, the state has sorted voters into districts based on the color of their skin,” Judges Barbara Milano Keenan and Arenda L. Wright Allen wrote in their majority opinion.

ADVERTISEMENT

The judges ordered lawmakers to redraw the state map by Oct. 30.

The ruling could affect partisan control of the Virginia General Assembly, where Republicans currently hold narrow majorities in both the state House and state Senate.

Democratic House Minority Leader Del. David Toscano praised Tuesday’s ruling as a win for fair elections, saying the current districts unfairly favor incumbents. He also said it would be good for his party.

“There will be many more opportunities for Democrats to win seats than ever before,” he said.

Republican House Speaker Kirk Cox said in a statement that he is disappointed in the court’s ruling and anticipates filing an appeal with the U.S. Supreme Court.

“It would be premature to even consider any action by the General Assembly until the Supreme Court speaks on these districts,” Cox said.

House elections are scheduled for 2019. Voter unhappiness with President Donald Trump helped Democrats gain 15 seats last year and almost take control of the House.

The lawsuit filed by Democratic voters over district lines drawn in 2011 made its way all the way up to the U.S. Supreme Court. In March, the high court threw out a ruling that upheld 11 districts in which African-Americans made up at least 55 percent of eligible voters and ordered the lower court to re-examine the boundaries.

The state argued that the 55 percent threshold was necessary so minority voters could elect a candidate of their choice, an important consideration under the federal Voting Rights Act. But the voters who sued said it diluted the voting power of African-Americans. The districts are in the Richmond and Hampton Road areas.

ADVERTISEMENT

The Supreme Court said the federal court used the wrong legal standard when it determined that race did not play too large a role in creating the 11 districts. The high court upheld one challenged district — the 75th — in which the lower court found that race was an important factor and that lawmakers were justified in considering it.

Democrats previously won a similar case involving the state’s congressional districts that led to new districts lines in 2016.

The judges in that case initially ordered the General Assembly to redraw the lines, but when lawmakers balked, the judges hired an expert to help them do it themselves.