Pennsylvania's congressional districts are a gerrymandered mess.

Take Montgomery County, where a 20-mile drive from the King of Prussia Mall, near the county's southern border, to Hatfield, on the northern border, requires you to pass through four different districts. You'd start in the 13th District (which resembles King Ghidorah, the three-headed Japanese kaiju) before crossing through a tendril of the 7th District, a cartoonish monstrosity. Then you'll enter the 6th district, which swoops like a shooting star from central Pennsylvania into the Philly 'burbs. Soon you're back in the 7th again before hitting another portion of the 13th and ending your journey in the actually-somewhat-reasonable-looking 8th.*

But the chaotic congressional districts in the Philly suburbs—and across the rest of the state—won't be used for this year's midterm elections. On Monday the state Supreme Court ordered the Pennsylvania legislature to redraw the district lines from scratch, giving them just three weeks to do it. The order creates an entirely different kind of chaos, and it may boost Democratic chances in the upcoming election.

If a new map doesn't make it through both chambers of the state legislature and get signed by Gov. Tom Wolf by February 15, then the court gave itself the authority to take over the process and draw a new map. The tight timetable is necessary because the state's primaries are held in mid-May, so candidates have to start filing and circulating petitions soon. At this moment, no prospective congressional candidate (nor any incumbent) knows in which district he or she resides.

Wolf, a Democrat, released a stoic statement about the ruling, saying he believes "gerrymandering is wrong and consistently have stated that the current maps are unfair to Pennsylvanians." Privately, Democrats are jumping for joy and Republicans are fuming. Drew Crompton, senior counsel for Senate President Joe Scarnati (R-Jefferson), says the Senate GOP will ask the U.S. Supreme Court to issue a stay halting the state court's order.

"I think its going to be difficult for the legislature to come up with a plan in three weeks, given the controversial nature of it," says Terry Madonna, a pollster and political scientist at Franklin and Marshall College.

There are, to put it mildly, huge political implications here. Republicans currently hold 13 of Pennsylvania's 18 congressional seats, in no small part because of the state's creative gerrymanders.

The state legislature and governor's mansion were in Republican hands when the current map was approved in 2011. There was also a Republican majority on the Supreme Court. (Pennsylvania's judges are elected via a partisan process and serve in what are technincally non-partisan roles on the bench**—but c'mon, everyone knows that's not a real thing.) As in other states where GOP-drawn maps have come under fire from the courts, Republicans seized on the opportunity presented by landslide wins in the 2010 election to cement their congressional majority with a conveniently -timed redistricting.

That Pennsylvania's congressional map is gerrymandered is plain to anyone who cares to look. That those bizarre lines give an edge to Republicans is also rather clear. In 2012, Democratic candidates received slightly more than 50 percent of the votes but were relegated to winning just five of the 18 seats. In 2014, GOP candidates got 56 percent of the vote in Pennsylvania's congressional races—and held their 13 seats. In 2016, Republicans got 54 percent and again won 13 districts.

But nothing about this is simple. When the map was drawn in 2011, the state Democratic Party declined to file a lawsuit challenging it (despite the fact that lawsuits were filed by outside groups; all were dismissed). At the time, Democratic leaders thought they had gotten a pretty good deal, all things considered. They had five deep blue districts unassailable by Republicans or anyone else. (Remember: Redistricting isn't merely a game of one party against another. It's a way party officials can exert control over members of their own tribe.) And a handful of the red-leaning districts were at least potentially winnable—even if it didn't turn out that way.

Republicans no longer hold all the cards in Pennsylvania. The GOP still controls the legislature, but the governor is a Democrat and Democrats have a 5–2 edge on the Supreme Court. Any map that gets approved within the next three weeks will have to get Wolf's approval, and the Democrat-controlled Supreme Court has given itself a trump card by claiming it can draw the maps itself if nothing gets passed. Republicans are boxed into a corner.

And that's why Monday's ruling has a whiff of politics to it. Maybe more than whiff. After all, it's "one of the best pieces of news House Democrats could get," notes Vox.

The precedent being set is worrisome. Even if the five Democratic justices had nothing but good intentions in tossing the map (a map that, again, is plainly political and terrible), this looks like a partisan play aimed at giving Democrats a better shot at winning the House in 2018. Courts should endeavor to stay above the political fray, and even the appearance of partisan motivation should be avoided in a case that is about literally nothing other than partisan political interests. That's particularly true in a state where judges are elected. Will every subsequent change in the balance of the state Supreme Court bring with it a command to redraw the congressional districts to the majority of the bench's liking? If so, Supreme Court elections in Pennsylvania just gained a nasty new level of significance.

Part of the problem is that there's really no objective standard when it comes to drawing districts. Federal law requires all congressional districts to have the same number of people, and the state constitution mandates that districts must be "compact and contiguious." But there's again no objective way to determind exactly how compact is compact enough.

Rather than rushing to redraw Pennsylvania's congressional map in the next few weeks, the court could have avoided the appearence of political motivation by letting the current map stand and setting clearer standards for what will or will not be allowed in the next redistricting cycle. Adding some detail to the vague "compact and contiguous" rules would make it clearer to lawmakers of both parties that a repeat of 2011's shenanigans will not be tolerated.

Republicans deserve to get burned for partisan maps drawn in bad faith. But Democrats don't deserve any credit for going along with those maps when they were drawn only to change course when they have a chance to affect the outcome of a congressional election.

None of that will solve Pennsylvania's—or America's—gerrymandering problem.

*For those who are curious, this route follows U.S. 422 West from the King of Prussia Mall to the interchange with Pennsylvania Route 363, then follows Route 363 North through Lansdale, then Pennsylvania Route 63 a short distance into Hatfield. It's a pretty straight shot across the middle of Montgomery County, no chicanery necessary.

** CORRECTION: This post has been corrected to clarify the process by which Pennsylvania judges are elected.