When President-elect Donald Trump replaces Barack Obama on January 20, the Democratic Party will find itself more removed from power than at almost any point since the party’s creation.

Scorned by the same voters who once embraced the New Deal, built the Great Society, and put their hope in the nation’s first black president, Democrats are now locked out of power in Washington and out of two-thirds of state legislative chambers across the country.

Simply put, Democrats’ once vaunted coalition of the ascendant — younger, multiethnic, educated, and urban — failed them in 2016, and in 2014 and 2010 before that. That coalition proved to have major handicaps, part demographic and part geographic, that have been hollowing out the party for years.

Democrats may find cold comfort in Hillary Clinton’s nearly 3 million popular vote lead and the fact that more people call themselves “liberal” than ever polled. And they can, and do, fairly protest a system of representative government that allows the government to be so unrepresentative of the popular vote. But it will be up to Democrats to solve their own problem within the current rules.

Source: Carl Klarner, Paul Levande (xenocrypt.github.io), National Conference Of State Legislatures

“You can’t say that the Democrats are at their absolute historical nadir because you can’t be at your absolute historical nadir when you win a popular vote majority,” said Tom Schaller, the political scientist and author of the book “Whistling Past Dixie: How Democrats Can Win Without the South.” “But you have a knife’s edge balance between the two parties and the knife is tilted towards one party for various structural reasons.”

Future demographic changes should eventually put Democrats back in the White House, but that will do nothing to solve their problems down ballot and could take more time than they can afford. To win again now, Democrats will have to beat their geographic disadvantage by holding together a diverse coalition that has already shown major signs of crackup.

Countless autopsies will be written of the 2016 election. Most will focus on the strategy and tactics of the Clinton campaign. But to understand how Democrats arrived in this mess to begin with, it helps to go back to the party’s founding over 150 years ago.

See How Democrats Got Here or jump to What Lies Ahead.

Part One How Democrats Got Here

The story of the 2016 election — the defection of white working class voters — mirrors the story of the Democratic Party.

Just as the Republicans have gone from the party of Lincoln to the party of Trump, the Democratic Party has undergone its own radical transformation from a Southern white party to a Northern cosmopolitan one.

The party that traces its founding to Thomas Jefferson and Andrew Jackson, two slaveholding Southern planters who created a party in their image, looks very different today.

It was once the stanchion of working class whites, mainly in the South. And “the farmer, the mechanic, and the laboring classes of society,” as Jackson called them, gave Democrats a sturdy demographic and geographic power base.

What happened? Video from the archives “How the Democratic Party transformed from a Southern white party to a Northern cosmopolitan one.” To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video Photo from NY Daily News Archive/Getty Images

Democrats dominated both chambers of Congress for nearly a century. From the 1930s to the 1990s, Republicans only managed to win control of the House twice, each time for a single two-year term.

Democratic power was strongest in the South, where they controlled virtually every Congressional district, governor’s mansion, state legislature and county council. Even as recently as 1988, when the South joined the rest of the country in voting overwhelmingly for George H. W. Bush over Democrat Mike Dukakis, it stuck with Democrats down ballot.

But relying on the “Solid South,” where Democrats had enacted Jim Crow laws and ruled without accountability, came with deep moral compromises for the party that would eventually prove untenable.

Republicans have a large state legislature advantage. That wasn’t always the case. Upper Legislative Chambers 2015 Party Shift 1989 Lower Legislative Chambers 2015 Party Shift 1989 More Dem. Leaning More GOP Leaning Lower Legislative Chambers Upper Legislative Chambers 1989 1989 2015 2015 1989 to 2015 Party Shift Source: Carl Klarner, Paul Levande (xenocrypt.github.io), National Conference Of State Legislatures.

In the early 20th century, Northern intellectuals, union members and immigrants began flocking to the working class party, swelling its ranks to help elect Franklin Roosevelt four times. Each time he ran, he carried every former Confederate state and major industrial cities. Harry Truman followed, giving Democrats two decades of White House occupancy.

The uneasy New Deal Coalition began to fray along the issue of civil rights. As John Kennedy and Lyndon Johnson pushed for racial equality, their fellow Democrats in the South, like George Wallace, fought it tooth and nail. When Johnson signed the 1964 Civil Rights Act, the Texan reportedly lamented, “We have lost the South for a generation.”

That’s when Republicans aimed their sights on the Solid South and on working class white Democrats everywhere. The GOP’s Southern Strategy played up racial grievances and highlighted cultural differences to lure voters away from a party that was drifting towards its liberal and urban wings.

Later, as a persistent wage gap grew between upper and lower income earners, many were turned off by Democrats’ embrace of free trade policies and the growing dominance of coastal elites, who seemed to look down their noses at “flyover country.”

Shifts in Political Power Since 1932 Shaded bands indicate party in control of the House House Senate Upper/Lower State Legislatures +100% Democrats Control House Republicans Control House 80 60 50% 40 20 1932 1947 1953 1979 1995 2010 2017 Shaded bands indicate party in control of the House House Senate Upper/Lower State Legislatures +100% 80 60 40 20 1932 1953 1979 1999 2017 Source: Senate.gov, Carl Klarner, Paul Levande, National Conference Of State Legislatures, Brown University, House.gov.

Many white working class voters found a more natural home in the GOP as both parties swapped territory and became more ideologically consistent. But these voters might have stayed if Democrats had made more of an effort to retain them.

In 2008, the Democratic base had been reborn. Obama’s victory that year would have looked foreign to Jackson and even Roosevelt. But as much as the Obama coalition was powered by young people, minorities, single women and educated urban dwellers, it also crucially included many blue collar whites. Union members helped him win Scranton, Pennsylvania, by 26 points (Clinton eked out a 3-point margin in 2016), and farmers helped him carry Iowa by 9 percentage points (Clinton lost it by 9).

In fact, Obama actually won more raw votes from non-college educated whites — because they are so numerous — than from African-Americans, Latinos, or educated whites.

Obama lost non-college educated whites by large margins in both 2008 and 2012, but they were still crucial to his victory. In fact, he actually won more raw votes from non-college educated whites — because they are so numerous — than from African-Americans, Latinos, or educated whites. They remain the single largest demographic voting bloc, even as their share declines slowly over time.

But Obama’s success obscured his party’s decomposition further down the ballot as the Democratic Party completed its metamorphosis from a working class white party based in the South to a multiethnic one based in cities.

Democrats once swept rural counties. Today their wins are concentrated in high-density, urban areas. Source: 2015 Density data from the American Community Survey 5-year. 1932 density data from the 1930 Census. 1932 election results from Dave Leip’s Atlas of U.S. Elections. 2016 data from NBC News. Density values are log-scaled. Trendline is computed with a linear model.

The last white Southern Democrat in Congress, Georgia Rep. John Barrow, wasn’t ousted until 2014. And it took until 2016 for Democrats to lose their final legislative chamber in the South, the Kentucky House of Representatives, which they had held without interruption since 1920.

The day after the election, Democrats woke up to a party that had lost most rural areas of the country, leaving behind a map that today looks like an archipelago of blue cities swimming in an ocean of red.

Once a mainstay of the white working class, the Democratic Party experienced a dramatic shift in makeup through the decades, with the civil rights era ushering in a profound change.

Geography is destiny?

Democrats’ wipe out in rural areas is politically deadly.

The party’s most obvious problem in 2016 was geographic: They got more votes across the country, but in the wrong places.

For the second time in 16 years, Democrats lost the Electoral College — and the presidency — even though they won the popular vote. And if you add up all 34 Senate races last year, Democrats won 6 million more votes, thanks largely to California and New York, while failing to retake control of the chamber. In 2012, they won 1 million more votes in the House and didn’t come close to winning it.

Democrats are quick blame Republican gerrymandering.

Obama’s former Attorney General Eric Holder recently launched a party-wide effort, backed by the outgoing president, focused on turning the tables on gerrymandering by winning back state legislatures ahead of 2020, when they will redraw congressional districts. The effort is crucial to Democrats’ ability to win back the House, since the party has only one chance to change the maps every 10 years.

But Democrats a have a deeper, structural problem beyond gerrymandering. Democrats lost the House in 2010 before Republicans had redrawn the maps.

The problem is quirky but its effects are profound: Electorally speaking, Democrats live in the wrong places.

America’s electoral system rewards the party whose voters are more spread out across the map and, for now, that means the GOP. Democrats are densely packed in major cities where they waste millions of votes winning inefficiently huge margins that can’t be effectively redistributed no matter which party is drawing the congressional districts.

In Pennsylvania, for example, Republicans control 13 of the state’s 18 congressional districts even though registered Democrats outnumber Republicans in the state by close to 1 million voters. Republican gerrymandering is responsible for much of that mismatch. But GOP mapmakers were aided by the fact that Democrats tend to be inefficiently concentrated in the state’s two major cities, Philadelphia and Pittsburgh.

The divide between the coasts was sharp in 2016. But past Democratic candidates won the heartland. Source: Coastal distances computed over projected distance from the center of each county to the nearest East or West coast as defined by National Oceanic and Atmospheric Administration GIS files. 1932 results from Dave Leip’s Atlas of U.S. Elections. 2016 data from NBC News. Trendline computed with a linear model.

Jowie Chen, a professor at the University of Michigan, has run hundreds of computer simulations to compare real election results to hypothetical ones in non-gerrymandered districts. The results show Democrats’ unintentional self-gerrymandering is arguably a bigger handicap than the GOP’s intentional gerrymandering.

In 2014, for instance, Republicans won 247 House seats with the help of Republican-leaning districts gerrymandered after the 2010 census. According to Chen’s simulations, however, the GOP still would have won 245 seat if the election were run again in non-gerrymandered districts.

Gerrymandering can have a big impact on individual states, like in politically divided North Carolina, where snaking districts help Republicans control 10 of the state’s 13 congressional seats. But Democrats also play this game in states they control, offsetting Republican gerrymandering, according to Chen.

Hillary Clinton’s running mate Tim Kaine delivered a speech entirely in Spanish to voters in Arizona (left) only days before the election — too late by some measures. Earlier in the year, the 2016 Democratic National Convention (right) was held in Philadelphia, a city that exemplified the party’s ineffective concentration of power.

Of course Democrats don’t want non-gerrymandered districts — they want district maps doctored for their advantage. So the potential upside from retaking state legislatures is significant. But in the aggregate, their gerrymanders will never be quite as effective as their more rural opponents.

Cities aren’t the only problem. Far-flung Democratic clusters along old industrial canals or small towns where universities happen to have been built a century ago also lead to wasted votes.

In conservative North Florida, for example, Democrats have pockets of support in Gainesville, home of the University of Florida, and in the state capital, Tallahassee. Clinton won Alachua and Leon Counties, home to both of those cities, respectively, by a 25-point margin. But geographically isolated Democratic redoubts like these often get subsumed by their conservative surroundings in congressional or state Senate elections with broad geographic districts.

Fluky as it may be, the inefficient distribution of Democratic voters makes it harder for Democrats to win no matter how congressional districts, state legislative districts, and even state boundaries are drawn. The mere existence of political boundaries at all is the problem.

“Because of the urbanization of the Democratic Party, any sort of geographic line-drawing is inherently going to value the rural party, and that’s the Republicans,” said Chen.

“There is no level of geography that systematically favors Democrats over the Republicans. There is no state where Democrats are geographically advantaged.”

And when it comes to the presidency, what matters is winning states — as 2016 showed clearly — not the national popular vote, thanks to the Electoral College. So anything that makes it a little harder for Democrats to win individual states also makes it a little harder to win the White House.

Democrats have long grumbled about their disadvantage in the Senate, where the heavily populated blue states of California and New York get the same two senators as do tiny red Wyoming or Idaho. The Senate makeup compounds Democrats’ disadvantage at the presidential level as well, since individual states receive the same level of representation in the Electoral College as they get in Congress, further empowering small states at the expense of large ones.

If you don’t hear much about this problem from Democrats, it’s because the forces behind self-gerrymandering are more economic and cultural than political.

Three-quarters of liberals say they prefer to live where “the houses are smaller and closer to each other, but schools, stores, and restaurants are within walking distance,” according to a Pew survey. An equal portion of conservatives say they prefer places where the houses are larger, but amenities are miles away.

People with college degrees often move to cities to pursue economic opportunities while their non-college cohort stay home. So cities suck up liberals from the countryside, leaving behind vast swaths of unguarded territory for Republicans. And there’s data to suggest living in cities actually make people more liberal.

Progressives are not sure how to address this problem other than to encourage hipsters to move to Iowa, as journalist Alec McGillis once suggested in a New York Times op-ed.

A sign showing support for then Democratic presidential candidate Sen. Barack Obama next to a cornfield in Iowa in 2007. Charles Ommanney/Getty Images

Making Des Moines — or Columbus, Ohio, or Raleigh, North Carolina, for instance — cool enough to attract would-be political homesteaders from Brooklyn may be outside the realm of traditional political strategy, but it might be one of the most effective ways for Democrats to secure their future.

Des Moines and other small cities are becoming increasingly attractive places to live, thanks to growing knowledge industries and revitalized downtowns. And the rising cost of living in major metros like San Francisco and New York are pushing many millennials to look elsewhere. Forbes named Des Moines the best city for Young Professionals in 2011, while Raleigh and Columbus both made the top 10 last year.

Without dramatic geographical shifts, the trend will only get worse for Democrats as both parties’ voters increasingly gravitate toward politically like-minded communities without even realizing it, a phenomenon laid out in Bill Bishop’s 2004 book “The Big Sort.”

Politics is becoming a bigger part of people’s identity, Bishop said, and a reliable indicator of what kind of car you drive, TV you watch, or food you eat. And with more mobility than ever, Americans naturally end up clustering together with people like them, leading to more politically polarized communities.

Democratic voters have become even more inefficiently distributed since 2000, when Al Gore won the popular vote by a narrower margin than Clinton, while also losing the Electoral College. And Democratic voters will distribute themselves even less efficiently in 2020 and 2024 and beyond — unless there’s a sudden exodus from major cities and the coasts.

Democrats’ distribution problem is not a fatal curse, but they’ll have to overcome the handicap and attract more voters in Republican-leaning areas.

A man in the audience holds a "Latinos for H" sign as Democratic presidential candidate Hillary Clinton speaks at a rally in Pueblo, Colo., in October. Andrew Harnik/Associated Press

Demographics

Last year, two demographers influential in Democratic circles, Bill Frey of the Brookings Institution and Ruy Teixeira of the Center for American Progress, along with Center for American Progress statistician and policy expert Rob Griffin, explored a half dozen possible paths for each party in the 2016 election. Most scenarios they ran through their rigorous statistical analysis favored Democrats, given the country’s underlying demographic change in the party’s favor. But one represented the party’s nightmare: Scenario F.

Scenario F predicted a hypothetical surge of white working class voters for Republicans on Election Day, similar to the one that actually helped Trump win. Their prediction nearly nailed the results (they missed the regional nature of Trump’s bump, assuming the surge would be more national), so Teixeira and Fry’s other conclusions should worry Democrats.

If they can keep those white working class voters in future presidential elections, “Republicans could obtain and keep an electoral vote advantage over a number of cycles, despite underlying demographic changes that favor Democrats,” the simulations predicted.

Worse, even if Democrats got a similarly sized surge in minority votes — Scenario E — “Democrats do not pick up any additional electoral votes,” the researchers added.

Unfortunately for Democrats, their geographic and demographic challenges overlap. For instance, Latinos, among whom Democrats have the most room to improve turnout, often live in politically unhelpful places. California alone is home to more than a quarter of the nation’s Latinos while another fifth live in Texas.

Midterm elections, like the upcoming one in 2018, remain a challenge for the Obama coalition.

Young people, minorities, and single women don’t come to the polls as reliably as Republicans’ older and whiter voters, contributing to the massive losses Democrats suffered in 2010 and 2014.

Democrats can win big in midterms, as they did in 2006. But that victory was fueled by a massive backlash against George W. Bush’s presidency, making it more of a fluke than a model. Democrats may get another windfall next year if Trump’s remains unpopular, but they’ll need a more sustainable way to win elections without the boost of a presidential campaign.

Part Two What lies ahead

The Democratic Party has been written off before, even as recently as 2002, when Bush consolidated power with Republican gains in both the House and Senate. But just four years later, Democrats took back Congress, and six years later they retook the White House, too, in a landslide.

Since the November election, the Democratic Party has been gripped by an existential dilemma: Does it try to win back white working class voters or cut them loose? While the choices aren’t mutually exclusive, they involve trade-offs in how the party speaks to voters and which ideas it prioritizes.

DeRay Mckessan Civil Rights Activist “It’s important to remember, white people aren’t the only working class voters in America.” To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video Photo by Patrick Semansky/Associated Press

While Democrats will inevitably attempt to pursue some combination of both — “We don’t need to decide between social justice and economic justice. We’ve got to have all of that,” Democratic National Committee Chair candidate Keith Ellison said — it’s worthwhile to examine the choices separately to clarify the differences.

0. Baseline

Democrats could always just call 2016 a black swan event and carry on without major changes. Clinton won the popular vote, after all, and many Democrats think she only lost the Electoral College because of Russian hacking or FBI Director James Comey’s last-minute intervention.

In the 2020 presidential election, the electorate will continue to evolve in Democrats’ favor as minorities and millennials make up a larger share of overall voters while non-college educated whites continue to decline. Indeed, four more years of natural demographic changes alone might be enough to give Democrats the relatively tiny number of voters Clinton would have needed in Pennsylvania, Michigan, and Wisconsin to win the Electoral College in 2016.

Average Voter Turnout by Age In General Elections Percent turnout by age 80% 60 40 20 30 40 50 60 70 80 Source: Voting average spans 1996 to 2008 elections. November Current Population Survey; Chris Kennedy (ck37.com)

In four years, Republicans’ base will get older while Democrats will get younger. Young voters turned out in lower numbers for Clinton than Obama, but they still broke for the Democratic nominee by a wide 55%-37% margin, according to exit polls. That’s a huge silver lining for Democrats. Millennials recently surpassed Baby Boomers as the biggest generation in the country and their voting power will only grow as more reach voting age.

Despite the maxims about everyone getting more conservative as they get older, plenty of research suggests Americans’ political views tend to crystallize in their early adulthood, leaving an imprint on how each generation votes for the rest of their lives. So millennials are likely to remain liberal as they age.

Turnout patterns by age look like an upside down Nike swoosh, rising steadily through young adulthood before plateauing in middle age from the 50s through the 70s, before falling precariously in the late 70s and 80s as mobility and health issues make it harder for voters to get to polls.

Projected Racial Composition of the Electorate White non-hispanic Black Asian alone Hispanic or Latino +100% Projection after 2016 80 60 40 20 0 2010 2012 2016 2020 Source: November Current Population Survey, Rob Griffin and the Center for American Progress’s States of Change Project, American Community Survey.

Still, even the most ardent Democrats agree that the 2016 election revealed deeper problems within the party’s coalition that will not be solved by waiting for older Republican voters to age out.

Their plans for climbing out of the abyss have fallen into two basic camps:

1. The Ohio path

One option for Democrats is to try to reconstruct as much of the lost portion of the Obama coalition as possible — ironically, by returning to the party’s white working class roots.

Ohio, long a presidential bellwether, is one of the upper Mid-Atlantic and Midwest states — including Pennsylvania, Wisconsin, Michigan — that had recently voted Democratic, but flipped for Trump. Democrats will probably never win the presidency again without winning back Pennsylvania or Michigan, which were both extremely close in 2016. But the question is what to do with places like Ohio and Iowa, both of which Obama won twice before Clinton lost them decisively.

States the Ohio Path Can Put in Play as Demographics Change In the Ohio scenario, 64 electoral votes are contested. White Black Asian Other Hispanic Projection after 2016 +100% +80 10 16 20 +60 18 +40 +20 +0 2008 2016 2024 White Black Asian Other Hispanic Projection after 2016 +100% +80 +60 +40 +20 +0 2008 50 2024 In the Ohio scenario, 64 electoral votes are contested. 10 16 20 18 Source: Current Population Survey, Rob Griffin and the Center for American Progress’s States of Change Project, NBC News data, NBC News exit polls.

To win back the white working class voters who populate both states, Democrats would likely need to de-prioritize policies that are either unimportant or alienating to these voters, like immigration reform, and so-called identity issues to refocus on a bread-and-butter economic message. Proponents of this path range from Sen. Bernie Sanders on the left to what remains of the party’s moderate “Blue Dog” caucus in Congress. That may not mean moving to the right on policy, and could entail a more populist direction on issues like free trade (something that has deeply divided Democrats).

But talking less about priorities of, say, the Black Lives Matter movement and more about those important to laid off factory workers risks turning off emerging parts of the Democratic coalition, like minorities and young people. And there’s no guarantee Democrats could even succeed in winning back non-college white voters in large margins.

Tim Ryan Democrat, Ohio “It’s heartbreaking to think that we can’t compete in rural America anymore as Democrats.” To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video Photo by Tom Williams/CQ Roll Call/Getty Images

2. The Arizona Path

The other option many Democrats favor would be to lean into their coalition’s future diversity, write off their losses with white working class voters, and hope demographic changes move quickly enough to catch up to them by the next elections.

Clinton’s late campaign foray into Arizona, a state that has long voted Republican, was widely seen as one of the campaign’s biggest follies. But she came within 4 points there and lost Georgia by just 5 points, while she lost Ohio and Iowa by nearly 10 percentage points each. Many respected analysts say Democrats’ future lies in the sunbelt, not the rust belt.

States the Arizona Path Can Put in Play as Demographics Change In the Arizona scenario, 71 electoral votes are contested. White Black Asian Other Hispanic Projection Projection after 2016 +100% +80 +60 15 +40 11 16 +20 29 +0 2008 2024 2016 2020 White Black Asian Other Hispanic Projection Projection after 2016 +100% +80 +60 +40 +20 +0 2008 2024 2016 2020 In the Arizona scenario, 71 electoral votes are contested. 15 11 16 29 Source: Current Population Survey, Rob Griffin and the Center for American Progress’s States of Change Project, NBC News data, NBC News exit polls.

Arizona and Georgia alone won’t win Democrats the presidency, but Georgia’s 16 Electoral Votes would nearly replace Ohio’s 18, and Arizona’s 11 are equivalent to Wisconsin’s.

The biggest, most tantalizing, game-changing prize on this path is Texas, with its 38 Electoral Votes. Clinton lost Texas by just 9.2% — less than her losing margin in Iowa — which was a dramatic improvement over Obama’s 16-point margin in 2012.

The strategy would require a dramatic realignment of political resources away from the traditional battlegrounds. And Democrats would likely need to re-prioritize immigration reform (Arizona) and issues important to African-American voters (Georgia), which may make it harder for the party to reclaim white working class voters.

No matter what, Democrats will need to reinforce their decaying state and local party apparatuses to build power outside cities. Conservatives understood the importance of these down-ballot races years ago and have invested heavily in them, while Democrats tended to concentrate on the presidency and interest-group specific causes.

Party leaders seem to have recognized the error and have the new Obama-backed effort to win state legislatures ahead of the next round of redistricting in 2020. If successful, the party will lessen the headwind of Republican gerrymandering, though they will still have their own self-gerrymandering to worry about.