A panel of U.S. federal judges struck down North Carolina’s congressional map on Tuesday, condemning it as unconstitutional because Republicans had drawn the map seeking a political advantage.

The ruling was the first time that a federal court had blocked a congressional map because of a partisan gerrymander, and it instantly endangered Republican seats in the coming elections.

Judge James Wynn, in a biting 191-page opinion, said Republicans in North Carolina’s legislature had been “motivated by invidious partisan intent” as they carried out their obligation in 2016 to divide the state into 13 congressional districts, 10 of which are held by Republicans. The result, Wynn wrote, violated the 14th Amendment’s guarantee of equal protection.

Read more:

U.S. Supreme Court says Republican lawmakers relied too heavily on race when drawing North Carolina electoral districts

Trump in trouble: 7 lessons from Democrats’ election wave on Tuesday

The ruling and its chief demand — that the Republican-dominated legislature create a new landscape of congressional districts by Jan. 24 — infused new turmoil into the political chaos that has in recent years enveloped North Carolina. President Donald Trump carried North Carolina in 2016, but the state elected a Democrat as its governor on the same day and in 2008 elected president Barack Obama.

The unusually blunt decision by the panel could lend momentum to two other challenges on gerrymandering that are already before the Supreme Court — and that the North Carolina case could join if Republicans make good on their vow to appeal Tuesday’s ruling.

In October, the court heard an appeal of another three-judge panel’s ruling that Republicans had unconstitutionally gerrymandered Wisconsin’s state assembly in an attempt to relegate Democrats to a permanent minority. In the second case, the justices will hear arguments by Maryland Republicans that the Democratic-controlled legislature redrew House districts to flip a Republican-held seat to Democratic control.

The Supreme Court has struggled without success for decades to develop a legal standard for determining when a partisan gerrymander crosses constitutional lines. The court once came close to ruling that such cases were political matters beyond its jurisdiction. But the rise of extreme partisan gerrymanders in the past decade, powered by a growing ideological divide and powerful map-drawing software, has brought the question back to the justices with new urgency. A Supreme Court ruling outlawing at least some such gerrymanders could reshape the political landscape.