WASHINGTON ― Democrats are increasingly confident they’ll take back the House after the midterm elections. But if the politicians and pundits are wrong, there may be one simple reason why: gerrymandering.

Gerrymandering is nothing new. Drawing politically advantageous district lines has been a staple of American politics for more than 200 years, even before then-Massachusetts Gov. Elbridge Gerry approved a new district for the state Senate in 1812 that resembled a salamander. (We got the word gerrymander by mashing together Gerry’s last name and “salamander.”)

But gerrymandering is getting more sophisticated, as mapmakers get more ambitious with the number of seats they target, as the districts they draw get more ridiculous-looking, and as the technology they use gets better.

On the new midterm podcast The Wave, I spoke with David Daley, author of Ratf**ked: Why Your Vote Doesn’t Count, and Dave Wasserman, the House political editor of The Cook Political Report, about gerrymandering and how it could prevent Democrats from taking back the House.

In Ratf**ked, Daley lays out how Republicans targeted state legislatures in 2010 with the aim of redrawing the congressional seats and creating a “red firewall” that could withstand demographic shifts and make it much more difficult for Democrats to hold the House of Representatives. Remarkably, for the bargain price of around $30 million, Republicans were able to flip 20 state chambers from Democratic to Republican in 2010, giving the GOP control of both the upper and lower houses in 25 states.

It was in those states that Republicans then proceeded to draw more gerrymandered maps.

Daley specifically looks at five relatively moderate states ― Pennsylvania, Michigan, Ohio, North Carolina and Wisconsin ― where Republicans drew maps that would subsequently lead to 48 Republicans and 21 Democrats in Congress.

“They have been the red firewall that have held back blue waves all decade,” Daley told me. “In 2012, when Democrats get 1.4 million more votes for the U.S. House, Republicans hold a 234-201 advantage in the chamber nevertheless.”

But not everyone is so convinced that gerrymandering has such a profound impact on the composition of the House.

Wasserman estimates that Republicans hold only about a half-dozen to a dozen more seats than they would under nonpartisan maps. Democrats do need to beat Republicans by a significant margin in the combined nationwide popular vote to retake the House, but to Wasserman, that is largely due to geography. Democrats are increasingly living in cities, while Republicans are taking up more room in the country.

What those geographical shifts mean is that it’s much easier to draw an advantageous map for Republicans than it is for Democrats.

Wasserman recounted a challenge he issued to his Twitter followers to draw up districts that would give Democrats a major advantage in Wisconsin, which has an even Cook Partisan Voting Index rating. (That means it closely resembles the partisan makeup of the nation as whole). Wasserman offered $7,000 to anyone who could produce a map where six of the eight congressional districts rated 8 points more Democratic.

Wasserman himself was easily able to draw a map where six of the eight district rated 7 points more Republican, but no one was able to claim the money ― likely because the task is impossible.

According to Wasserman, yes, the number of vulnerable swing districts is declining. The Cook Political Report calculated that the number of swing districts has declined from 164 in 1997 to 72 in 2018. But again, Wasserman sees this more as a consequence of natural political dynamics and geography. According to that study, the reduction in the number of swing districts was only 17 percent in redistricting years, meaning 83 percent of it was just natural shifts in other years.

Still, even Wasserman recognizes that Republicans have some seats because of gerrymandering, and the effect of those safer seats also means Republicans have more money to pour into other, more vulnerable races.

So with Democrats expected to pick up at least around 15 seats, a Republican majority that hangs on to the House would only be in the single digits, meaning even by the most bearish accounts for Democrats, a GOP majority would have those mapmakers to thank.

“Republicans advantage in gerrymandering will likely be their margin of victory if they do hold the House,” Wasserman said.

You can listen to the full podcast on Apple Podcasts, Google Podcasts, Spotify, or Castbox.