Pennsylvania holds the key to the 2018 midterms for Democrats — and could determine which party will control the House of Representatives come January 2019.

The good news started for Democrats in this month’s special election for Pennsylvania’s 18th Congressional District: Conor Lamb beat Republican Rick Saccone in a district that Donald Trump won by 20 points in 2016 and that Republicans had held for 15 years. It kept flowing this week, with a prominent House Republican, Ryan Costello, announcing that he will retire rather than defend his seat and then news that Democrats will likely avoid a contentious primary in another race.

With the filing deadline now past, several races are shaping up to be very favorable to Democrats this November in Pennsylvania.

A landmark gerrymandering lawsuit had already cracked open the door for Democrats in the Keystone State: The state Supreme Court decided recently that Pennsylvania’s House districts needed to be redrawn because Republicans had unfairly tilted them too far to their advantage, and the resulting redistricting gave Democrats a leg up.

Add in the enthusiasm among Democratic voters and the evidence that even voters in Trump country have soured on the Republicans, and Pennsylvania provides the clearest path for Democrats to make major gains in their bid to win 20-odd seats and take control of the House.

“It’s a huge prime opportunity for Democrats. If it’s a really incredible year for them, you could swing six seats potentially,” Nick Field, who writes about state politics for WHYY in Philadelphia and PennLive, told me recently. “If they swing six seats in Pennsylvania, you’re one-quarter of the way there in one state. I think it’s going to be a huge part of the Democrats’ midterm plan.”

This week’s two big pieces of good news for Democrats in Pennsylvania

The latest ripe opportunity for Democrats is in Pennsylvania’s Sixth District. Over the weekend, Republican Rep. Ryan Costello announced that he would not run for reelection this year.

The announcement was both shocking and not. Costello, at 41, is relatively young and moderate, with two comfortable wins in 2014 and 2016, the kind of Republican who should do well in the Philadelphia suburbs that he represents.

But his district is daunting for Republicans after the gerrymandering. As the New York Times noted, the old Pennsylvania Sixth went for Hillary Clinton by a percentage point — voters in the redrawn district favored the Democratic candidate by 9 points.

The terrain wasn’t likely to get any easier for the GOP Congress member, with Democrats energized and Republicans demoralized. As Vox’s Tara Golshan wrote of Costello’s decision:

Already, an unexpected Democratic win in a special election in Pennsylvania’s 18th District, where Trump won by nearly 20 points in 2016, is giving Democrats momentum. “In some respects, my ego says to run,” Costello told his local newspaper. “But when I look at what is the right decision for those who rely on me and the state of our body politic, I am convinced that no matter how bipartisan and open and transparent I am, there is so much anger out there that it doesn’t matter.”

With Costello’s retirement, the Cook Political Report moved the Pennsylvania Sixth District from “toss-up” to “likely Democrat.”

The other piece of good news came for Democrats on Tuesday, when progressive candidate Beth Tarasi, who had been weighing an insurgent primary bid against the newly elected Lamb, announced that she would withdraw from the race.

Because of redistricting, Lamb’s current district, the 18th, will no longer exist, and he has chosen to instead run in Pennsylvania’s 17th District against sitting GOP Rep. Keith Rothfus.

“It became clear after the extraordinary circumstances of the special election in PA-18 Conor Lamb is a strongly supported candidate, who in the new PA-17 would be a very worthy opponent for Mr. Rothfus,” Tarasi said in a statement to PoliticsPA.

Tarasi’s withdrawal should clear the way for Lamb to run the kind of campaign that helped him prevail this month, without worrying about backlash from the left. The analysts at Cook rate the race a “toss-up”; the new 17th District is a Trump +10 district, and Lamb just won in a Trump +20 district. It should be a strong pickup opportunity — with the unusual benefit of having Lamb as a sitting Congress member challenge another incumbent.

Why Pennsylvania is already set up so well for Democrats

Gerrymandering is the big story for Democrats in Pennsylvania, aided by the national environment (Democratic voters are energized, Republican voters are demoralized) in what is still a competitive state. (Trump’s win was shocking, but he won by less than a point.) The president isn’t particularly popular there, with a 42 percent approval rating as of January, according to Gallup.

At the top level, here is how Vox’s Andrew Prokop explained the impact of the redistricting required by the Pennsylvania Supreme Court:

First off, districts’ potential competitiveness can be measured in different ways, but if we take the obvious measurement of how much each presidential candidate won in each district in 2016, we move from: - 11 districts Trump won by 5 points or more in the old map to 9 in the new map - Four districts Clinton won by 5 points or more in the old map to 6 in the new map - Three swing districts that neither presidential candidate won by more than 5 points in both maps So even from that bird’s-eye view pegged to 2016 results, it’s clear that, on net, two districts became much more Democratic in the new map.

Republicans hold 13 of the state’s 18 congressional seats. As of this writing, the Cook Political Report ranks five of the GOP-held seats as likely Democrat, lean Democrat, or toss-up.

Two other Republican-held seats are rated likely Republican but could end up being, at least in theory, competitive. We won’t know who the Democratic candidate will be in those races until the May primary, but in at least one of those races — the 10th, where Republican Rep. Scott Perry is running — there are several credible Democratic challengers: a former Obama administration official, a previous House candidate, an Air Force vet, etc. A seismic national Democratic wave could put those seats in play as well.

“In terms of redistricting statewide, it’s a huge, prime opportunity for Democrats,” Field told me.

That’s how Democrats have a chance to win as many as six seats in Pennsylvania alone. Democrats need to flip 23 seats to take the House majority, and they have a very plausible path to winning five of them in the Keystone State — maybe more if things break their way. The blue wave starts here.