In the November election, a million more Americans voted for Democrats seeking election to the U.S. House of Representatives than Republicans. But that popular vote advantage did not result in control of the chamber. Instead, despite getting fewer votes, Republicans have maintained a commanding control of the House. Such a disparity has happened only three times in the last century.

Analysts and others have identified redistricting as a key to the disparity. Republicans had a years-long strategy of winning state houses in order to control each state's once-a-decade redistricting process. (Confused about redistricting? Check out our song.)

Republican strategist Karl Rove laid out the approach in a Wall Street Journal column in early 2010 headlined, "He who controls redistricting can control Congress."

The approach paid off. In 2010 state races, Republicans picked up 675 legislative seats, gaining complete control of 12 state legislatures. As a result, the GOP oversaw redrawing of lines for four times as many congressional districts as Democrats.

How did they dominate redistricting? A ProPublica investigation has found that the GOP relied on opaque nonprofits funded by dark money, supposedly nonpartisan campaign outfits, and millions in corporate donations to achieve Republican-friendly maps throughout the country. Two tobacco giants, Altria and Reynolds, each pitched in more than $1 million to the main Republican redistricting group, as did Rove's super PAC, American Crossroads; Walmart and the pharmaceutical industry also contributed. Other donors, who gave to the nonprofits Republicans created, may never have to be disclosed.

While many observers have noted that mega-donors like Sheldon Adelson backed losing candidates, a close look at the Republicans' effort on redistricting suggests something else: The hundreds of millions spent this year on presidential TV ads may not have hit the mark, but the relatively modest sums funneled to redistricting paid off handsomely.

Where Democrats were in control, they drew gerrymandered maps just like Republicans. They also had their own secretive redistricting funding. (Last year, we detailed how Democrats in California worked to undermine the state's attempt at non-partisan redistricting.) But Democrats got outspent 3-to-1 and did not prioritize winning state legislatures. They also faced a Republican surge in 2010.

Exactly how the Republican effort worked has been shrouded in mystery until now. But depositions and other documents in a little-noticed lawsuit in North Carolina offer an exceptionally detailed picture of Republicans' tactics.

Documents show that national Republican operatives, funded by dark money groups, drew the crucial lines which packed as many Democrats as possible into three congressional districts. The result: the state's congressional delegation flipped from 7-6 Democratic to 9-4 in favor of Republicans. The combination of party operatives, cash and secrecy also existed in other states, including Wisconsin, Ohio and Michigan.

Redistricting is supposed to protect the fundamental principle of one-person-one-vote. As demographics change, lines are shifted to make sure everyone is equally represented and to give communities a voice. In order for Republicans to win in North Carolina, they undermined the votes of Democrats, especially African-Americans. (Party leaders in North Carolina say they were simply complying with federal voting laws.)

The strategy began in the run-up to the 2010 elections. Republicans poured money into local races in North Carolina and elsewhere. It was an efficient approach. While congressional races routinely cost millions, a few thousand dollars can swing a campaign for a seat in the state legislature.

The Republican effort to influence redistricting overall was spearheaded by a group called the Republican State Leadership Committee, which has existed since 2002. For most of that time, it was primarily a vehicle for donors like health care and tobacco companies to influence state legislatures, key battlegrounds for regulations that affect corporate America. Its focus changed in 2010 when Ed Gillespie, former counselor to President George W. Bush, was named chairman. His main project: redistricting.

Soon after Gillespie took over, the RSLC announced an effort to influence state races throughout the country, the Redistricting Majority Project, or REDMAP. Fundraising soared. The group raised $30 million in 2010, by far its best year. (Its Democratic counterpart raised roughly $10 million.)

The RSLC is organized as a type of political group that can take in unlimited corporate donations. It must disclose its contributors. But that doesn't mean it's always possible to trace the origins of the money.

Along with Walmart and tobacco companies, the RSLC's largest funders in 2010 were the Chamber of Commerce and American Justice Partnership, which gave a combined $6.5 million. Those two groups raise money from corporations and others but don't have to disclose their donors.

As the 2010 North Carolina legislative elections heated up, the RSLC jumped into local races. But the way they made contributions kept their involvement away from the attention of state voters. Rather than running campaign ads under its own name, the RSLC distributed money to a newly-formed local nonprofit. The RSLC declined to comment.

The RSLC gave $1.25 million to its vehicle of choice, Real Jobs NC. The group calls itself a "non-partisan organization that believes we need to return to a reliance on the free enterprise system that made our country great for real answers." It was started in 2010 and got a hefty $200,000 boost from dollar store magnate and Republican supporter Art Pope, although Pope denies his donation was related to redistricting or REDMAP.

Real Jobs NC produced ads and mailers slamming more than 20 state Democrats.

"Steve Goss … nice guy," intoned the voice-over in one such ad in North Carolina, attacking then-Democratic State Senator Goss. "Too bad he's voting with the Raleigh liberals over hometown conservatives."

Goss lost, and Democrats lost control of North Carolina's General Assembly for the first time in a century. The pattern repeated itself across the country.

"Twenty legislative bodies which were previously split or under Democratic control are now under Republican control," said a triumphant RSLC REDMAP post-election analysis, highlighting its spending in Wisconsin, Ohio, Pennsylvania, and North Carolina, among other states.

The next step for Republicans was to draw district maps, which can be expensive. The maps require expertise, extensive data and sophisticated software. Skillful map drawers can make even the most partisan gerrymander look reasonable.

To fund the work, the Republican State Leadership Committee used its previously dormant nonprofit arm, the State Government Leadership Foundation. Such dark money groups are increasingly popular because they are allowed to keep secret the identity of their donors. Federal tax law permits them to do this as long as they pledge that politics is not their primary focus.

Flush with anonymous donors' cash, the Foundation paid $166,000 to hire the GOP's pre-eminent redistricting experts, according to tax documents. The team leader was Tom Hofeller, architect of Republican-friendly maps going back decades.

"Our team would be happy to assist in drawing proposed maps, interpreting data, or providing advice," wrote Chris Jankowski, the head of both the RSLC and State Government Leadership Foundation, in a letter of introduction to North Carolina legislators. The letter was disclosed as part of the North Carolina lawsuit.

"We are engaged in a number of states and believe we are playing a meaningful role in helping draw fair and legal lines that will allow us to run competitive elections in 2012 and in future cycles," Jankowski added.

The same letter emphasized that the Republican redistricting push was being funded through its dark money nonprofit: "The entirety of this effort will be paid for using non-federal dollars through our 501c(4) organization."

Jankowski, representing both the RSLC and the Foundation, declined to comment.

Because Hofeller's team was paid with dark money and the redistricting process is so secretive, it is hard to know the full extent of its activities. In Wisconsin, the team provided technical assistance to an aide to Rep. Paul Ryan as he drew new districts that favored Republicans. In Missouri, Hofeller was the sole witness called by attorneys representing the Republican legislators who drew the maps there.

In the case of North Carolina, Hofeller made his first trip to Raleigh on Feb. 1, 2011, even before final state Census data had been released — the first of 10 trips that year.

From then on, two parallel redistricting processes unfolded in the state.

Through the spring and summer, legislators in charge of redistricting traveled the state holding public meetings at local colleges, soliciting comment and proposed maps from citizens — though the Republicans on the committee would not produce draft maps themselves.

"We are not here to answer questions. We are not here drawing maps," state Senate redistricting committee chairman Bob Rucho told the crowd at a hearing in Durham. "What we are here for is to basically hear your thoughts and dreams about redistricting."

But that input had little influence on the districts that were eventually drawn.

Instead, the real maps were being produced behind the scenes by a team that based its operations at Republican Party headquarters on Hillsborough Street in Raleigh. Armed with advanced mapping software, Hofeller and others crafted districts that would virtually guarantee big gains for the party.

Hofeller did not attend or read transcripts of any of the public meetings, according to his deposition. Hofeller did not respond to requests for comment.

A mysterious state dark money nonprofit that sprung up just in time for the process, called Fair and Legal Redistricting for North Carolina, hired a technician to operate the mapping workstation day-to-day, and another Republican mapping expert. The group did not respond to our requests for comment.

State-based nonprofits have been a vehicle for Republicans to funnel anonymous money into their map-drawing operations in a number of states, including self-proclaimed nonpartisan groups in Michigan and Minnesota.

Republican state legislators tasked with redistricting frequently visited and consulted with the mapping team, according to depositions. Even Art Pope, the most influential conservative donor in the state, was appointed "co-counsel" to the legislative leadership and allowed in the room to give direct instructions to the technician.

"We worked together at the workstation," said Joel Raupe, the technical expert paid by Fair and Legal Redistricting, in a deposition. "He sat next to me."

Pope, who is a lawyer but does not actively practice, was made co-counsel to the state legislature, offering his services pro bono. Now, because he was technically a legal adviser to the state, he says any information about his involvement in the redistricting is privileged.

(The New Yorker had a sweeping profile of Pope last year, detailing how he has used his fortune to dominate North Carolina politics.)

North Carolina's Republican incumbents in Congress pushed for a so-called "10-3 map," the majority they hoped to win in the state's delegation.

Hofeller, the mapping expert, delivered. His maps kept most of the districts from being competitive — or even remotely winnable — for Democratic candidates.

A key part of the redistricting strategy was to push minority voters into three districts. Republicans insisted their maps were "fair and legal," necessary to conform to laws protecting minority voting rights, although according to a well-known voting rights attorney, the opposite is true.

Federal voting rights law "doesn't require a jurisdiction to pack blacks in districts," said Laughlin McDonald, director of the American Civil Liberties Union's Voting Rights Project. "If you tried to pack minority voters into a district, that would arguably be a violation."

In two of those districts, African-American incumbents had been winning by large margins for years. Republicans' maps added yet more African-Americans to the districts, what's known in redistricting parlance as "packing." As Hofeller wrote in an email about one of the districts, the plan was to "incorporate all the significant concentrations of minority voters in the northeast into the first district."

A third district was 120-mile long, and sea monkey-shaped, connecting pockets of African-Americans from three different, distant cities. Republicans justified it on the basis of a common media market.

The maps were designed to "segregate African-American voters in three districts and concede those districts to the Democrats," says Bob Hall of Democracy North Carolina, a nonpartisan public interest group that joined the lawsuit against the new maps.

In 2012, Democrats won the three districts by more than 70 percent of the vote. Another effect: The surrounding districts were much more Republican.

Rucho and other Republican legislators had presented the maps as advantageous to Democrats. Indeed, registered Democrats actually outnumbered registered Republicans in seven additional districts beyond those that were clearly slated to be Democratic.

Emails show Republicans decided to make that fact a major talking point.

But the stat was misleading, as the Republicans' own data indicates. An internal analysis of one of Hofeller's later drafts (code name "Blue Horizon 3") obtained by ProPublica shows that those seven allegedly "competitive" districts would have been landslide wins for John McCain in 2008, and for Republican Senator Richard Burr in 2010.

The carefully drawn maps worked. In this year's elections, Democratic candidates for the U.S. House of Representatives in North Carolina won 50.6 percent of the total vote. But the state's House delegation now has nine Republicans and just four Democrats. One of the Democrats won by just a few hundred voters, despite the fact that his newly-drawn district skewed heavily Republican and that his own home had been drawn out of it. North Carolina's delegation before the election had seven Democrats and six Republicans

In addition to his pay from national Republican groups, invoices show Hofeller billed North Carolina taxpayers $77,000 for his services.

The Republican maps are still under threat by suits filed by Democrats and the NAACP. The lawsuits are headed to the state Supreme Court. But a flood of contributions tied to the RSLC have lowered the risk of the maps' being overturned.

While judicial elections in North Carolina are nominally nonpartisan, it was common knowledge that Republicans held a 4-3 majority on the court. One of those Republican incumbents was facing a tough challenge in 2012, potentially throwing the whole redistricting result in jeopardy.

Justice Paul Newby was running for re-election against appellate judge Sam Ervin IV, grandson of the famous North Carolina senator who investigated Watergate. With a few weeks left until the November election, Newby was trailing Ervin.

But then, in the final stretch, Newby was the beneficiary of a flood of late spending that can be traced back to the Republican State Leadership Committee.

Once again the contributions were funneled through homegrown groups. With only a few weeks to go, the RSLC gave more than $1.1 million to a group called Justice for All NC. Campaign finance filings show Justice for All NC in turn gave nearly $1.5 million to a super PAC running pro-Newby ads, the NC Judicial Coalition.

Most of the money spent by the super PAC went to pay for hundreds of airings of a jingle ad featuring lines like, "Paul Newby / Justice tough but fair / Paul Newby / Criminals best beware" set to infectious banjo music.

The spending didn't end there, and Pope's fingerprints were also on the race. Two dark money groups affiliated with Pope — the state-based Civitas Action and Americans for Prosperity — spent another $300,000 on radio ads and mailers supporting Newby. Pope's company also gave to the RSLC in the run-up to this fall's elections.

Pope says he gave money to Americans for Prosperity for years before the judicial race even came up, and that he was not involved in the decision to run pro-Newby ads.

"I'm Republican, I support Republican groups," Pope said. "But just because you support something doesn't mean you're responsible for all they do."

It was an unusually large amount of outside spending for a judicial race. The outside pro-Newby groups had spent more on the race than the two previous campaigns combined.

In the end, Newby eked out a 52-48 victory, preserving the court's Republican majority.

When the groups contesting the maps called for Newby to recuse himself from redistricting litigation, lawyers for Republican legislators argued that because the campaign ads were paid for by "independent" groups, they did not jeopardize Newby's impartiality.

On Monday, the state Supreme Court rejected the motion for Newby to recuse himself.

"I've got no control over who contributes to an ad. I have no control over who endorses me," Newby — who did not respond to a request for comment — told a local TV station on the eve of the election. "You've got to put your blinders on like lady justice."