Pennsylvania's Supreme Court has redrawn the map of the state's congressional districts, overturning a Republican gerrymander that's been used in the past three congressional elections.

The new map more closely reflects the partisan composition of the state, all but ensuring that Democrats will pick up several new U.S. House seats in November. It's also more compact than Republicans' original map, and it splits fewer counties and municipal areas — a key concern of the court as it sought to ensure voters' ability to participate in “free and equal” elections.

The original Republican-drawn map had become the butt of national jokes due to its reliance on strange, sprawling shapes to create a balance of electoral power heavily tilted toward the GOP. While Democratic candidates for the state's 18 U.S. House seats tend to capture about half of the statewide popular vote, that's translated into just five of the 18 seats in each election held since the 2011 redistricting.

In response to a lawsuit filed by the League of Women Voters, the Pennsylvania Supreme Court in January ordered the map to be redrawn, ruling that the Republican-drawn districts “clearly, plainly, and palpably” violated the state's Constitution. The Republicans' plan was “aimed at achieving unfair partisan gain” and “undermines voters’ ability to exercise their right to vote in free and ‘equal’ elections, if the term is to be interpreted in any credible way,” the court ruled.

Because the state's Republican-led legislature and Democratic governor were unable to agree on a new map by Feb. 15, the court itself took on the process of redistricting.

The court addressed the old map's partisan imbalance by creating a new map that contains eight districts that were won by Democrat Hillary Clinton in the 2016 election and 10 that were won by Republican Donald Trump. Presidential and congressional votes are highly correlated, and split-ticket voting is rare. This suggests it's possible that Pennsylvania Democrats could see a net gain of three or even four seats in the November election.

Moreover, the court-drawn map splits just 13 Pennsylvania counties between multiple districts, fewer than half as many as Republicans' 2011 map. And the court-drawn districts are twice as compact as the 2011 districts, based on one common measure of geographic compactness.

In ordering the new map, the court's majority wrote that it draws heavily on a number of map proposals submitted by the governor, members of the legislature and third parties. The court said that its map is “superior or comparable” to all the submitted proposals based on “traditional redistricting criteria of compactness, contiguity, equality of population, and respect for the integrity of political subdivisions.”

Michael McDonald, an elections expert at the University of Florida, wrote that the new Pennsylvania map shares characteristics with a court-drawn map in Florida. “We've now had two state Supreme Courts — FL and PA — order the creation of fairer congressional redistricting plans for their states that obviously are more compact and respect more political boundaries than the Republican gerrymanders they replace,” he wrote.

Dave Wasserman, House editor for the Cook Political Report, wrote that “the PA Supreme Court's map doesn't just undo the GOP's gerrymander. It goes further, actively helping Dems compensate for their natural geographic disadvantage in PA.”

Rick Hasen, an elections expert at the University of California at Irvine, wrote that “the early indications are that this is a much more competitive map which will help the Democrats compared to the gerrymandered maps drawn by the Republican legislature.”

Pennsylvania Republicans are almost certain to challenge the new map in court. State Senate Majority Leader Jake Corman wrote last week that the Pennsylvania Supreme Court created a “constitutional crisis” with its ruling and timeline for the creation of a new map.

But Hasen noted that Republicans' legal options for challenging the new maps are limited. The U.S. Supreme Court already rejected one challenge to the Pennsylvania court's ruling, and Republicans are on uncertain legal ground when it comes to any new challenge in federal court.

“Bottom line: it is hard to see where Republicans go from here to successfully fight these maps,” Hasen concluded.

Trump, however, urged the GOP to keep up the legal fight.

"Hope Republicans in the Great State of Pennsylvania challenge the new “pushed” Congressional Map, all the way to the Supreme Court, if necessary," Trump tweeted early Tuesday. "Your Original was correct! Don’t let the Dems take elections away from you so that they can raise taxes & waste money!"

Brian Murphy contributed to this report.