These charts show how future control of Congress could be decided by this year's statehouse elections

The U.S. House and Senate races are getting all the money and media coverage, but the most important contests this fall could be between the relatively unknown candidates vying for seats in your local statehouse.

That's because, in most states, those legislatures will soon redraw the congressional district maps that will heavily influence which party controls the U.S. House of Representatives for the next decade, a process known as gerrymandering.

"Both Democrats and Republicans have gerrymandered to shore up districts," said Michael Li, an election law and redistricting specialist at the Brennan Center for Justice. "Since the district maps are drawn by political branches, political considerations are paramount. And everything else — racial fairness and bringing communities together — goes on the wayside."

The process of gerrymandering has become the subject of widespread court challenges over the last decade. This year, ballot initiatives in a handful of states will let voters decide whether to put the process in the hands of bipartisan commissions tasked with taking a more even-handed approach than partisan politicians.

"People on both sides think the system is rigged, so there's a lot of energy this year," Li said.

Redistricting takes place every 10 years, based on the latest Census data showing where American voters live. As the population shifts, some House districts are redrawn to meet the constitutional requirement that each of the 435 districts contain roughly equal numbers of voters. States where the population is growing pick up new seats; those with population declines have to give up seats. The original aim was to give every voter roughly equal representation.

In practice, though, the total number of popular votes doesn't determine which party controls Congress.

Thanks in part to the added leverage provided by carefully drawn district maps, Republicans for the last two decades have usually won a greater share of seats in Congress than their overall share of the popular vote. It hasn't always been this way. For many decades, the district maps worked to favor Democrats.

The task of redrawing a state's congressional districts usually falls to the legislature. The party in power has broad discretion to draw district boundaries to make it easier for their party's candidates win a seat on Capitol Hill.

The process often produces sprawling, oddly shaped districts. There are a variety of techniques for maximizing party advantage, but they typically involve grouping together pockets of voters from your party and diffusing clusters of voters that tend to vote for the opposing party.

"Republicans want to tack in minorities to just a few districts, and Democrats want to spread them out among many districts," Li said.

With a new Census due in 2020, the party control of statehouses over the next two election cycles will have a major impact on which party controls Congress. The importance of these statehouse races was underscored this summer, when former President Barack Obama took the unusual step of endorsing dozens of Democratic candidates for statehouse across the country.

Obama's list of endorsements includes just a handful of the 6,069 state legislative seats up for regular elections this year — some 82 percent of all seats. Forty-six states are holding scheduled elections in November for 87 out of 99 state legislative chambers. Nebraska is the lone state with a single-body, or unicameral, legislature. The rest have upper and lower chambers like Congress.

Many of those candidates will be elected for four-year terms, which means they'll be in office when the 2020 Census results are in and the redistricting process begins.

Republican control of state legislatures is relatively new; Democrats controlled more state houses for much of the last eight decades. But that began to change in 2000.

Like this year's national congressional races, Republicans have more to lose at the state level than Democrats. Having gained ground in three out of the last four election cycles, Republicans control both the state House and Senate chambers in 25 states; Democratic control just seven; 17 more are split.

The "blue wave" Democrats are hoping for on the national level may well extend to state houses across the country. In past midterms, the party of the president has lost around 400 state legislative seats on average, according to the National Conference of State Legislatures.

If there is a blue wave, Democrats have a solid chance to flip legislative chambers, according to Ben Wexler-Waite, communications director of Forward Majority. The super PAC is focusing on retaking legislatures for Democrats in competitive swing districts.

"The Republicans have been gerrymandering and focusing on down-ballot races for years. It's a distortion of democracy. Everyone right now is paying attention to control of Congress, but we need to start thinking about Congress two-four years from now to ensure that districts are drawn fairly," he said.

Since 1902, the incumbent president's party has lost state legislative seats in 27 of 29 midterm election cycles. (The two exceptions were 1934 and 2002.) The last major rout at the state level happened in the 2010 midterms, when Democrats got what Obama called a "shellacking." Some 708 statehouse seats changed hands, more than in any election since 1966. according to the NCSL.

Any shift in seats will have the greatest impact in states where the party in power is already holding a slim majority. That means the most critical races are being held in states where one party holds a narrow majority of seats in either chamber. Legislative chambers with single-digit percentage majorities include state senates in Colorado, Connecticut, Delaware, Maine, Nevada, New York and Washington, along with lower houses in Connecticut, Maine, New Mexico and Washington.

Partisan redistricting is less of an issue in the handful of states that already turn over the task of drawing district maps to an independent body, including Arizona, California, Idaho and Washington.

Redistricting has become a bigger issue in states where court challenges have forced changes in maps drawn by political partisans. Pennsylvania had to throw out its district maps and start over again for the 2018 election; North Carolina was recently ordered to redraw its maps, but will use the existing maps for the 2018 vote. Similar court challenges are pending in Texas, Louisiana, Arkansas, Alabama, Georgia, Virginia, Maryland, Wisconsin, Michigan, Ohio and Connecticut.

Thanks in part to those court challenges, voters in five states will get to decide whether turn over the task of drawing their state's district maps to independent commissions. Those initiatives are on the ballot this year in Michigan, Utah, Missouri, Arkansas and Oklahoma. Similar measures are before the state legislatures in Colorado, Ohio, Pennsylvania and Virginia, according to the Brennan Center for Justice.

Controlling state government, of course, also depends on who is living in the governor's mansion, and voters in 36 states will make that choice in this midterm election.

Nearly half of those are open seats, where the incumbent has chosen not to run or has reached the state's term limits. In those governor's races, Republicans have more to lose than Democrats. The GOP currently holds 33 governorships, Democrats control 16, and an independent, Bill Walker, is the governor of Alaska.

Together with their statehouse majorities, the GOP controls both legislative chambers and the governorship in 25 states; Democrats have all three in eight states; and 16 states have split party control. While New York Democrats hold enough seats to control the legislature, a Democrat caucuses with Republicans in the Senate, which gives effective control to Republicans. So, in practice, control is divided between the two parties.


Get the best of CNBC in your inbox

Please choose a subscription

Please enter a valid email address
Get these newsletters delivered to your inbox, and more info about our products and service. Privacy Policy.