WASHINGTON (AP) — Even if Democrats recruit great candidates, raise gobs of money and run smart campaigns, they face an uphill fight to retake control of the House in this year's congressional elections, regardless of the political climate in November.

The reason? Republican strategists spent years developing a plan to take advantage of the 2010 census, first by winning state legislatures and then redrawing House districts to tilt the playing field in their favor. Their success was unprecedented.

In states like Ohio, Michigan and North Carolina, Republicans were able to shape congressional maps to pack as many Democratic voters as possible into the fewest House districts. The practice is called gerrymandering, and it left fertile ground elsewhere in each state to spread Republican voters among more districts, increasing the GOP's chances of winning more seats.

Geography helped in some states. Democratic voters are more likely to live in densely populated urban areas, making it easier to pack them into fewer districts.

The first payoff came in 2012, when Republicans kept control of the House despite a Democratic wave that swept President Barack Obama to a second term. The next payoff is likely to come this fall when candidates once again compete in House districts drawn by Republican legislators in key states.

Gerrymandering has a long history in the United States, pursued enthusiastically by both Democrats and Republicans. But the GOP's success at it this decade has been historic: In 2012, Republicans maintained a 33-seat majority in the House, even though GOP candidates as a group got 1.4 million fewer votes than their Democratic opponents.

It was only the second time since World War II that the party receiving the most votes failed to win a majority of House seats, according to statistics compiled by the House Clerk. Democrats gained eight seats but were still a minority.

"The fact that Republicans controlled redistricting (after 2010) meant that they were able to build up a wall, stopping a lot of the tide from running out," said Justin Levitt, a law professor and redistricting expert at Loyola Law School in Los Angeles. "They were able to shore up a lot of the districts that had been won by, in many cases, tea party freshmen or other Republican freshmen."

Story continues

The Republicans' advantage will fade as the decade wears on and the population changes. In the meantime, lopsided House districts are having a direct impact on the ability of Congress to tackle tough issues. House districts are drawn so that Democrats and Republicans often represent very different groups of people with different views on divisive issues. That can make it hard to find common ground.

Democrats control the White House and the Senate, though control of the Senate will be up for grabs in November. Republicans control the House, giving them powerful leverage to block Obama's second-term agenda.

How did Republicans gain their historic advantage? It all started with the party's sweeping victories in 2010 and a plan called REDMAP.

The 2010 election was a disaster for Democrats. Voters were angry over bank bailouts, the poor economy, ballooning budget deficits and Obama's new health law, which had just passed Congress without a single Republican vote. All these issues fueled the rise of conservative tea party groups that backed Republican candidates up and down the ballot.

Obama called the election "a shellacking."

Republicans picked up 63 seats to win control of the House. They also gained seats in the Senate, though Democrats kept their majority.

Perhaps more important, Republicans won control of state legislatures in key states, giving the party the edge that is still paying dividends.

Every 10 years following the census, states redraw the boundaries of House districts to account for population changes. Some states gain seats and others lose them, so the overall total remains 435. In most states, the legislature and the governor draw up the new districts, which is why political parties pay special attention to elections at the start of each decade.

"I think Democrats made a terrible mistake. They did not put nearly enough attention or resources into legislative races at the state level," said Matt Bennett, a former aide to President Bill Clinton. "A bunch of these legislatures slipped by very narrow margins, and some of them flipped for the first time since Reconstruction in the South."

For Republicans, it was a combination of luck and planning. The political winds were in their favor, but they also had been plotting for years to take full advantage of redistricting.

The project was called REDMAP, which stood for Redistricting Majority Project. It called for targeting statehouse races in states that were expected to gain or lose congressional seats following the census. GOP strategists reasoned that redistricting could have a greater impact in these states because there would have to be more changes to district boundaries, said Chris Jankowski, former president of the Republican State Leadership Committee, which heads up the party's national effort to elect candidates to state offices.

Republicans spent more than $30 million through REDMAP to help elect legislative majorities in states like Ohio, Michigan, North Carolina, Pennsylvania and Wisconsin, Jankowski said.

In Ohio, REDMAP spent nearly $1 million on six Ohio House races. Republican candidates won five, helping them take control of the Ohio House.

In Pennsylvania, REDMAP spent nearly $1 million on three state House races, winning all three and helping Republicans win a majority in the Pennsylvania House.

"We're not talking about 2-month-long broadcast buys on network TV that never stop, like you see in a U.S. Senate battle," Jankowski said. "We're talking about cable, radio, mail, ground game — very basic stuff."

Similar scenarios played out in Michigan and Wisconsin. In North Carolina, Republicans won control of the entire state legislature for the first time since the 1800s.

"We targeted the resources to have maximum impact on congressional redistricting," Jankowski said.

The strategy worked. Before the 2010 election, the GOP had majorities in 36 state legislative bodies. Afterward, the party controlled 56, according to the National Conference of State Legislatures.

In almost half the states, Republicans won control of the entire redistricting process. They gained control of at least one legislative chamber in other states, limiting Democrats' ability to draw districts favoring their candidates.

Democrats' statehouse losses in 2010 were "a catastrophe that is going to have a much bigger impact on Obama's second term than the congressional elections that year did, because it's much more durable," Bennett said.

In all, Republicans controlled the process of drawing the boundaries for 210 House districts, compared to just 44 districts for Democrats, according to statistics compiled by Levitt. The rest were drawn by divided government, the courts, or in a handful of mostly western states, independent commissions.

Six states illustrate the Republicans' advantage in House elections: Ohio, Michigan, Pennsylvania, Virginia, Wisconsin and Florida. Obama won all six in both the 2008 and 2012 presidential elections. But the House delegation for each state is overwhelmingly Republican.

It might seem like voters split their ballots — voting for a Democrat for president and a Republican for Congress. But that's not what happened.

To help analyze voting patterns in congressional districts, The Associated Press divided the votes from the 2012 presidential election into all 435 House districts.

Since Obama got the most votes, you might think he won the most congressional districts. But he didn't.

Nationally, Obama received nearly 5 million more votes than Republican Mitt Romney. But in some states, large numbers of Obama's votes were packed into heavily Democratic congressional districts. As a result, Romney won 17 more House districts than Obama.

Ohio, Michigan, Pennsylvania, Virginia, Wisconsin and Florida accounted for the entire disparity. Obama won the statewide vote, but Romney won the most congressional districts in each state.

Republicans engineered these disparities by packing large numbers of Democrats into relatively few districts. This resulted in lopsided Democratic districts. For example, Obama won more than 80 percent of the vote in 26 House districts spread across 10 states.

Republican voters were spread more evenly. As a result, Romney won more than 80 percent of the vote in just a single House district, in the Texas panhandle.

Lopsided districts help explain why Congress is so polarized. The divide is reflected in demographic differences, which can shape the debate on a variety of issues.

— Immigration. The average Democratic district has about twice as many Hispanic residents as the typical Republican district. This helps explain why House Republicans have less incentive to pass an immigration bill that would provide a path to citizenship for millions of people living in the U.S. illegally.

— Minimum wage. Democrats represent the vast majority of districts with large pockets of low-income workers and families living in poverty. That helps explain why Democrats are more eager than Republicans to raise the minimum wage. Interestingly, Democrats also represent most of the wealthiest districts, along the East and West Coasts.

— Health care. Democrats represent the vast majority of districts with high concentrations of people who had no health insurance before Obama's new health law, one of many reasons Democrats and Republicans view the law so differently.

Independent experts give Democrats little chance to retake the House this year. Even beyond Republicans' redistricting advantage, the party of the president usually loses seats in Congress during midterm elections.

Still, Rep. Steve Israel of New York, who is in charge of the House Democrats' campaign operation, rejects arguments that Democrats can't do it, regardless of the map.

"There's no question that midterm elections are more challenging for the party whose president is in power," Israel said.

Jankowski, on the other hand, expects Republican candidates to continue enjoying the fruits of redistricting. But he notes that people move and populations change. As the decade wears on, the political benefits diminish, and another redistricting battle will loom.

"It has a shelf life to it and it's usually not the full 10 years," Jankowski said. "That's the reason we have a census every 10 years."

___

Associated Press senior research coordinator Cliff Maceda contributed to this report.

___

Follow Stephen Ohlemacher on Twitter at http://twitter.com/stephenatap