For the Republican Party, the 2010 midterm elections have been a gift that keeps on giving.

Besides sending Democrats into the political wilderness, the electoral surge that swept Republicans to the House majority also gave them control of the lion's share of state legislatures, just as the decennial redrawing of local voting districts was set to begin. Sensing a once-in-a-generation opportunity, GOP officials executed a detailed, swing-state plan to carve out safe legislative districts for themselves, accusations of gerrymandering (and allegations of racism) be damned.

They've held the House majority ever since.

Outmaneuvered and outgunned in 2010, however, the Democrats have assembled an impressive arsenal to fight back: federal lawsuits, a partisan redistricting think tank and a heavy war chest funded by their fired-up donor class and angry grassroots voters. Glimmers of success abound -- including a near-miss in flipping a Georgia congressional district from deep red to bright blue, and a Supreme Court ruling that rejected micro-engineered, race-based districts the GOP drew up in North Carolina.

Yet the Democratic offensive to wrestle redistricting control from Republicans is an uphill battle at best. And the long odds against the party stem from an ugly collision of bad timing, blown opportunities, strategic blunders and the beatdown the GOP laid on them at the national and local level seven years ago.

"In the 26 states that account for 85 percent of congressional districts, Republicans derive a net benefit of at least 16-17 congressional seats in the current Congress from partisan bias," according to a report, titled, "Extreme Maps," from the Brennan Center for Justice, a think tank based at New York University. "That advantage represents a significant portion of the 24 seats Democrats would need to pick up to regain control" of the House in 2018.

Put another way: Since the 2010 wave election, the GOP has unified control of both chambers of state legislatures in 33 out of 50 states. And the party used that power not only to draw districts that gave themselves a majority on Capitol Hill but to create "safe seats" for Republican incumbents, districts that are difficult if not impossible for Democrats to flip.

Meanwhile, the lawsuits in which the Democratic Party has prevailed don't provide immediate relief for the problem.

Despite federal judges having ruled that the political districts are gerrymandered, "Court-ordered modifications to maps in Florida, Texas, and Virginia – all originally drawn under sole Republican control – have reduced but not entirely curbed these states' partisan bias," according to the report. And the Supreme Court, with another big gerrymandering case on its docket in the fall, is still trying to clarify the blurred line between drawing a district to get a partisan advantage, and setting up minority voters, and their preferred candidates, to fail.

"We haven't gotten it right legally. But the problem itself is getting worse," says Michael Li, a Brennan Center researcher who co-authored the report, "Extreme Maps," released in May. "That's because data and [computer] technology can allow us to draw maps with more precision than in the past. We can draw [district] maps or engineer maps with microprecision. That's making these gerrymanders worse."

Agreed, says Jon Greenbaum, chief counsel and senior deputy director of the Lawyers Committee for Civil Rights Under Law. Political winners get to draw the legislative districts, and the lines between creating a partisan advantage and diluting the voting strength of African-Americans and Latinos has become increasingly blurry.

"The Supreme Court at a minimum is going to allow for a certain measure of partisanship," says Greenbaum. "The question is, when does it cross the line to become unconstitutional – which is something the court has never seriously answered."

There's no doubt that gerrymandering – named for unwieldy districts Massachusetts Gov. Elbridge Gerry created to keep himself and his party in power in the 1800s – dates to the nation's founding. In the 1780s, Patrick Henry and his cohorts literally drew a legislative district around James Madison's home to keep him out of Virginia's House of Representatives.

Over generations, as the nation grew and population boomed, redistricting became more sophisticated, with computer models eventually replacing hand-drawn maps. But it also become a double-edged sword: Responding to demands for more minority representation in state and local government, the powers that be created majority-minority districts; yet that logic, Greenbaum and others say, has become a cloak for "packing" – putting as many black and Latino voters in as few districts as possible, diluting their electoral strength.

"The argument was sort of turned on its head," says Greenbaum. "You had the Democratic Party, sometimes in combination with African-American activists, saying, 'Now you're drawing these districts much more black than they needed to be."

Arguably the most significant example of a party amping up its political muscle through redistricting has been the Republicans' State Legislature Redistricting Majority Plan, a.k.a. Project RedMAP . The plan, rolled out ahead of the 2010 midterm elections, focused on Democrats' weakness in state-level government: If the GOP won big at the state level, it would have unprecedented control of the redistricting process.

It worked. Republicans took 19 state houses and senates, then, when districts were redrawn in 2011, helped itself to the new House seats identified in the Brennan Center report and a partisan advantage that's still paying dividends.

Pennsylvania – a battleground state that Barack Obama won twice in back-to-back elections – went for President Donald Trump in the last election cycle. Yet though "it's a 50-50 state" with a Democratic governor, Li of the Brennan Center says , "Republicans have 13 out of 18 congressional districts. That doesn't look like Pennsylvania."

"[Michigan, North Carolina and] Pennsylvania consistently have the most extreme levels of partisan bias," according to the report. "Collectively, the distortion in their maps has accounted for seven to ten extra Republican seats in each of the three elections since the 2011 redistricting, amounting to one third to one-half of the total partisan bias across the states we analyzed."

While the overall landscape looks bleak for Democrats, the Supreme Court has indicated it's willing to wrestle with the issue and lay down some guidelines.

Following up a surprising ruling that North Carolina Republicans illegally packed black voters into legislative districts, the high court agreed to hear arguments in a gerrymandering complaint from Wisconsin – a key battleground state that has had unified Republican government since 2011.

While the central question the court will decide is whether the GOP went too far in drawing hyper-partisan voting boundaries to keep themselves in power, the case is viewed as an important marker that could help establish boundaries that Republicans can't cross, a prospect that Democrats could use as a stepping stone back to power.

"The Supreme Court until the 1960s didn't think that redistricting was something that you could even litigate about," says Greenbaum, of the Lawyers Committee for Civil Rights Under Law. "They consider it the province of the legislature."

In June, however, the court ruled that it's legal for it to take up the issue by taking up the Wisconsin case, Greenbaum says. That may be good news for Democrats but it's unclear whether there's a majority of justices who agree with the left's arguments that the districts are unfair, or if a ruling would come down in time for the 2018 midterms.

"What happens is it takes awhile" for the cases to be decided, Greenbaum says, including for the parties in conflict to come to an agreement on what a fair district would actually look like.

Ultimately, the solution most likely falls to Democrats, experts say: The only way to reverse the Republicans' gains is to start winning elections at the local level. They've taken steps to do that, including creating the National Democratic Redistricting Committee, which is focused on pushing back against Republican gerrymandering.

The committee held a closed-door, big-dollar fundraiser with former President Barack Obama, who has made redistricting a priority of his post-office public life. But redistricting reform was on the president's mind before he left office six months ago.

In his final State of the Union address last January, Obama warned both Democrats and Republicans that failure to address the problem could result in the nation "forsak[ing] a better future." The powerful forces behind the issue, he said, "will gain greater control over the decisions that could send a young soldier to war, or allow another economic disaster, or roll back the equal rights and voting rights" that activists fought and died to secure.