The North Carolina GOP drew district lines to prevent the election of Democrats. A federal court just ruled they cannot use that map in 2018.

For years, congressional elections in North Carolina have been completely uncompetitive. Republicans in the state legislature had rigged them with the most aggressive gerrymander in the country, packing Democrats together and spreading out Republicans to ensure the GOP would always win a majority of seats.

But advocates of fair congressional representation won an enormous victory in the Tar Heel State on Tuesday.

A district court sided with the League of Women Voters of North Carolina, who were represented by the Campaign Legal Center. In a 200-page ruling, the court found that the state’s congressional map is so partisan it violates the Constitution — and that a new, fair map must be drawn by Jan. 24.

Depending on the exact district lines of the new map, this decision could result in Democrats gaining 2 to 5 new seats in the 2018 midterm elections.

The map that the court struck down was itself drawn up in 2016 by Republicans in the North Carolina General Assembly, after another series of federal court rulings — which were upheld by the Supreme Court — found that the previous GOP-drawn map was an unconstitutional racial gerrymander.

As the court opinion blisteringly points out, the second Republicans were told by the courts they could not pack voters in by race, they just openly switched to packing in voters by party:

Representative Lewis said that he “propose[d] that [the Committee] draw the maps to give a partisan advantage to 10 Republicans and 3 Democrats because [he] d[id] not believe it [would be] possible to draw a map with 11 Republicans and 2 Democrats.”

Polls in North Carolina show that even Republican voters think their legislature’s attempts to rig elections were too much.

All over the country, gerrymandering is being challenged. Virginia elected a Democratic governor who promised to veto any rigged map from Republican lawmakers. In Pennsylvania, the state courts are examining another such GOP scheme. And the Supreme Court is set to rule on a landmark case on the issue from Wisconsin.

It is time for the GOP to stop resorting to tricks and start campaigning on the merit of their ideas.