On Monday, the Pennsylvania Supreme Court invalidated the state’s congressional map, holding that it constitutes a partisan gerrymander that “clearly, plainly and palpably” violates the Pennsylvania Constitution. The court ordered the legislature and governor to devise a new nonpartisan map for the 2018 election cycle, and warned it will commission its own if the elected branches cannot agree on one. Monday’s ruling gives Democrats a real shot at winning a majority of the state’s congressional districts in November, bolstering their chances of seizing the House of Representatives.

Pennsylvania’s gerrymander has long stood out as one of the worst in the country. GOP lawmakers drew the state’s districts in 2010 to maximize their own party’s electoral success, to great effect: Although registered Democrats significantly outnumber registered Republicans in Pennsylvania, Republicans won 13 out of 18 congressional districts in 2016. An Associated Press analysis found the gerrymander gave Republicans at least three extra House seats.

In 2017, voting rights advocates sued, asking state courts to strike down the map in time for the 2018 election. Crucially, they sued exclusively under the state constitution, which provides a robust guarantee of free expression and association that goes beyond the federal First Amendment. The Pennsylvania Constitution also protects “free and equal” elections, enshrining a right to vote that surpasses the safeguards of the federal Constitution. A majority of the state Supreme Court—all five of its Democratic members—found that these provisions render Republicans’ gerrymander unlawful.

The GOP-controlled state legislature now has until Feb. 9 to draw a nonpartisan map and submit it to Democratic Gov. Tom Wolf, who must approve the plan by Feb. 15. If the legislature and the governor cannot agree on a map by that date—which seems likely given the partisan split—the court will swiftly commission its own map. The court ordered lawmakers to draw districts “composed of compact and contiguous territory” that are “nearly equal in population” and do not needlessly split up communities.

Monday’s decision is almost entirely immune from review by the U.S. Supreme Court. The majority clarified that it based its ruling solely on the state constitution, of which it is the final arbiter. The U.S. Supreme Court can only adjudicate federal questions; it cannot overturn the Pennsylvania Supreme Court’s interpretation of the Pennsylvania Constitution. Republicans might ask the U.S. Supreme Court to intervene on the grounds that Monday’s ruling violates the federal Constitution by stripping power from the state legislature. But that claim would be an extreme long shot, as the U.S. Supreme Court rejected a similar argument out of Arizona in 2015. In all likelihood, then, Pennsylvania’s gerrymander will gone well in advance of the 2018 elections—and for the first time this decade, Democrats can finally compete in genuinely fair districts.