A federal court ruled on Monday that North Carolina Republicans illegally drew up U.S. congressional districts in the state to benefit their party, suggesting that new lines be crafted before November’s election.

The three-judge panel for the U.S. District Court for the Middle District of North Carolina said in a 321-page opinion that Republican legislators responsible for the map conducted unconstitutional partisan gerrymandering to dilute the impact of Democratic votes.

“That is precisely what the Republican-controlled North Carolina General Assembly sought to do here,” the opinion said.

The panel gave parties until Thursday to file their recommendations to fix the problem.

The decision could have national implications in this November’s battle for control of Congress. Democrats need to pick up 23 seats to gain a majority in the U.S. House of Representatives that could thwart Republican President Donald Trump’s legislative agenda.

Among the suggestions from the judges were holding state nominating primaries in November with new district lines that remove illegal partisan bias and then holding a general election before the new U.S. Congress is seated in January 2019.

The North Carolina dispute centered on a congressional redistricting plan adopted by the Republican-led legislature in 2016 after a court found that Republican lawmakers improperly used race as a factor when redrawing certain U.S. House districts after the 2010 census.

The Republican lawmaker in charge of the plan said it was crafted to maintain Republican dominance because “electing Republicans is better than electing Democrats.”

Party officials were not immediately available for comment on the court’s decision.

Republicans in 2016 won 10 of the 13 House districts – 77 percent of them – despite getting just 53 percent of the statewide vote, nearly the same result as in 2014.

In June, the U.S. Supreme Court threw out a lower court ruling that Republicans drew the boundaries to ensure electoral victories for their party.

But the justices sent the case back to the federal three-judge panel to reconsider whether the plaintiffs, including a group of Democratic voters, had the necessary legal standing to sue in the case.

“If this opinion stands … the court may well order new districts be drawn in time for the 2018 elections,” Rick Hasen, a professor at the University of California, Irvine, wrote on his election law blog.

“North Carolina’s gerrymandering was one of the most brazen in the nation, where state legislative leaders proudly pronounced it a partisan gerrymander,” he wrote. …