A voter casts his ballot during the 2012 U.S. presidential election at a polling station on Staten Island. (Keith Bedford/Reuters)

A recent analysis by political scientists John Sides and Eric McGhee suggests that Democrats are poised to win a majority of votes in U.S. House contests but walk away with a minority of seats — again. As I wrote last week, a big factor in this odd disparity is the way some Republican state legislatures have gerrymandered congressional districts in a way that gives them far more House seats than their popular vote totals would suggest.

For a refresher on how gerrymandering happens, recall that the Constitution mandates that every 10 years, seats in the U.S. House are doled out to states according to state populations, as determined by the decennial census. In 2010, for instance, it worked out that a state got one house seat for roughly every 710,000 inhabitants. States have to assign each of their House seats to a congressional district. This requires drawing a map that splits a state up into a number of geographic regions, each with a population of about 710,000.

In most states, this process is done by the state legislature with the approval of the governor. So you see where the potential for shenanigans starts to creep in: If the statehouse and governor's mansion are controlled by the same political party, there's not much to stop them from drawing congressional districts in a way that maximizes that party's representation in the U.S. Congress.

The process of re-drawing district lines to give an advantage to one party over another is called "gerrymandering". Here's how it works. (Daron Taylor/The Washington Post)

Below is an abstracted illustration of how this can work. It supposes we have a very tiny state of 50 people, each represented by a square. Thirty of them belong to what we'll call the Blue Party, and the 20 others to the Red Party.

The illustrations show how you can divide those 50 people up into five different geographic “districts” in ways that either accurately represent the party divide in the state or that give one party or another an advantage relative to their population. Here's a deeper explanation of what's going on in this abstract scenario.

Still, it can be tough to move, conceptually, from this abstract scenario to a real-world illustration that shows exactly how gerrymandering influences the party split in the U.S. House. Fortunately, Stephen Wolf of the liberal news site Daily Kos put together some maps showing how this works in the real world, using North Carolina as an example.

First, here's the actual Republican-drawn map of North Carolina congressional districts, used in 2014.

You can see that the map allows Republicans to win 10 out of the 13 congressional districts in the state, while Democrats get just three. But in 2012, a majority of North Carolina voters cast their vote for Democratic House candidates. Because of the way this map was drawn, packing most of those voters into a small number of districts, Democrats' majority share of the vote translated to less than 25 percent of the actual seats.

But what if the tables were turned, and Democrats were in charged of the redistricting process after the 2010 census? Wolf redrew the districts, using census data and geographical software, to come up with a map that would favor Democrats. Here's what that hypothetical scenario would look like.

(Stephen Wolf/Daily Kos)

This map takes Democrats from a three-to-10 deficit to a nine-to-four advantage in seats. The spread between these two outcomes — the Republican-drawn map and the Democratic one — illustrates the stunning amount of leeway that lawmakers have to draw boundaries to give themselves an advantage.

Regardless of how people actually vote, lawmakers can set things up so that those votes translate into massive advantages for one party or another. In a democracy, voters are supposed to choose their representatives. But gerrymandering like this lets representatives choose their voters, setting the democratic process on its head.

Wolf used North Carolina as an example, but you could draw similarly divergent maps for just about every large state. Nationwide, a 50-50 partisan split at the ballot box could be gerrymandered into a huge Democratic House majority or a similarly lopsided Republican majority.

It doesn't have to be this way, of course. Wolf also drew a nonpartisan map for North Carolina — one that yielded a House delegation much closer to the actual party split in the state. Here's what that looks like.

(Stephen Wolf/Daily Kos)

That map yields five seats that lean Republican, five where Democrats are favored and three where the party split in the district is so even that it's impossible to say who would win there. It accurately reflects the actual partisan makeup of voters in the state.

Wolf has drawn similarly nonpartisan maps for all 50 U.S. states. Under those maps, Democrats would have won a 17-seat majority in the House in 2012, or 52 percent of the seats. That number closely reflects the 51 percent of voters who cast ballots for Democratic House members that year.

Having a nonpartisan map doesn't mean that Democrats would have a lock on the House for the near future, either. In 2014, for instance, Republican candidates won about 53 percent of the two-party vote for the U.S. House. It's likely that control of the House would have flipped to Republicans under Wolf's nonpartisan map scenario.

But a more representative government, as envisioned by Wolf and other reformers, will remain a pipe dream so long as partisan legislators are able to draw district lines however they wish. The obvious solution is to take the redistricting process out of the hands of state legislators, thus eliminating some of the partisan bias that creeps into the process. A number of states do this to some degree or another, putting the process under the jurisdiction of committees that have varying degrees of independence from the state parties.

Other solutions involve simply letting computers draw the district lines according to some easy-to-understand criteria, such as geographic compactness.

Regardless of your preferred solution, Wolf's North Carolina maps vividly illustrate the huge leeway lawmakers have to manipulate the rules of congressional mapmaking to their own advantage.

More from Wonkblog:

This is actually what America would look like without gerrymandering

How racial gerrymandering deprives black people of political power

Here's the completely legal way to 'rig' an election

This is the best explanation of gerrymandering you will ever see