North Carolina cannot use the existing maps for its congressional districts in next year's elections, a state court ruled late Monday, declaring them to be invalid partisan gerrymanders.

The ruling was a victory for state Democrats who lost a battle when the U.S. Supreme Court ruled earlier this year that such challenges were beyond the authority of federal courts to referee. So the fight resumed in state court, citing violations of North Carolina's constitution.

A three-judge panel of state judges issued an order Monday barring state officials from using the current map for the coming elections, including the March presidential primary. The panel stopped short of ordering the legislature to draw new maps but said disruptions could be avoided "should the General Assembly, on its own initiative, act immediately and with all due haste to enact new congressional districts."

The ruling said delaying the primary could reduce voter turnout and increase the cost of the election. But it said, "those consequences pale in comparison to voters of our state proceeding to vote, yet again, in congressional elections administered pursuant to maps drawn in violation of our North Carolina Constitution."

The legislature designed the current maps in 2016 after a court declared the congressional district boundaries to be an unconstitutional racial gerrymander. But the new maps were drawn to ensure the partisan breakdown of the state's congressional delegation⁠: 10 Republicans and three Democrats.

In 2016, a Republican state legislator involved in the process, Rep. David Lewis, said "I think electing Republicans is better than electing Democrats," adding at the time that he drew the map "to help foster what I think is better for the country."

In their lawsuit, the challengers said the map may be "the most extreme and brazen partisan gerrymander in American history." The legislature limited the ability of Democrats to elect the candidates of their choosing by concentrating them into just three districts and diluting their voting strength in the remaining ones, the court concluded.

The state court earlier this year struck down the boundary lines for state house and senate districts on similar grounds. The legislature declined to appeal and instead redrew the maps in time to meet the court's two-week deadline.

The Supreme Court's ruling in June declared that partisan gerrymandering cases were off limits for the federal courts. But it nonetheless said state courts could consider such challenges. Some justices were stinging in their criticism of North Carolina's map and a similar gerrymander in Maryland. Such blatantly partisan moves, said Elena Kagan, "debased and dishonored our democracy, turning upside-down the core American idea that all governmental power derives from the people."