According to President Obama, the election that gave Donald Trump and the Republicans full control of the federal government and their greatest dominance at the state level since the Civil War had nothing to do with his policies. We Democrats have “better ideas,” he insisted to the press. “But I also believe that good ideas don’t matter if people don’t hear them.” Hillary, one might conclude from Obama’s remarks, just didn’t work hard enough.

The president’s argument echoes through much of the Democrats’ gloomy post-mortem. The problem was Hillary’s schedule, or not enough “get-out-the-vote organizing, or James Comey’s interventions. And, of course, the racist and sexist voters in fly-over America, who are too stupid to understand their own interest.

There is some truth to all of that. But the consoling claim that it wasn’t our product that failed but merely our marketing leads to a dangerous conclusion: that all the Democrats have to do is to organize harder and wait for the vile and buffoonish Trump to implode.

The Trans-Pacific Partnership, however, was not a “better idea.” Neither was the failure to prosecute Wall Street CEO’s after the fraud-driven financial collapse that brought on the Great Recession. Nor the timid fiscal stimulus that stranded millions in the slowest recovery on record.

To be fair, these were not simply Obama’s mistakes. They were the fruits of a culture of the implicit—and at times, explicit—contempt for working-class America that has been spreading through much of the Democratic Party’s leadership for several decades.

As Democrats ponder their future, a little history might help.

Democrats’ reaction to Ronald Reagan’s victory over Jimmy Carter in 1980 was a gut-wrenching shock similar to what they have experienced in the past few weeks. Reagan wanted to privatize Social Security, ran a racist campaign against the “welfare queen riding in a Cadillac,” and seemed willing to bring us to nuclear war with the Soviet Union. Liberals were sick to their stomachs that election night.

Trump is not Reagan. And 2016 is not 1980. But both elections were lost by tone-deaf Democratic elites who dismissed the economic anxieties of the working class.

As the unemployment rate began to rise in the winter of 1979-80, progressive Democrats appealed to Carter for a jobs program to offset the damage being done by the Federal Reserve’s high interest rates. Carter rejected the idea because Wall Street would not accept more spending.

“Aren’t you worried about the president’s re-election?” I asked his staff at one White House meeting. Eyes rolled. “Do you really think that we could be beaten by Ronald Reagan?” one smirked. “The star of Bedtime for Bonzo?” Laughter all around.

Thus—in reaction to Carter’s inaction—was born the Reagan Democrat.

Election exit polls that year showed that the chief concern of voters was unemployment. But Democrats blamed the defeat on Carter’s dour personality and the Iran hostage crisis. They were confident that Reagan’s loony economics would limit him to one term, and the blue-collar workers who voted for Reagan would soon come back home.

Meanwhile, Carter’s efforts to make Democrats more business-friendly had opened doors to Wall Street’s money. A generation of New Democrats—neoliberals—argued that because their party had a lock on the House of Representatives, which wrote tax laws, they would always be the senior partners in their relationship.

But, like Carter, they felt forced to prove their fiscal conservatism to their new financiers. Walter Mondale, Carter’s vice president, ran in 1984 against Reagan’s deficits, which were delivering jobs and growth. He lost. So did Michael Dukakis, with a similar message in 1988. He lost, too. Reagan tripled the national debt—and became a folk hero to conservatives.

It took 12 years for the Democrats to come back to the White House, and then only when Reagan’s successor, George H.W. Bush, mishandled a recession and a third-party candidate siphoned votes from the Republicans. In 1994, Newt Gingrich picked the lock the Democrats thought they had on the House of Representatives, and with it went the leverage the neoliberals thought they had over Wall Street.

That Democrats did not want to be seen as anti-business in a capitalist America was understandable. But there was another option: an alliance with industry rather than finance. By the 1980s it was becoming obvious that the United States was losing its international competitiveness. In response, a network of industrialists, labor leaders and Democrats such as Ted Kennedy and Mario Cuomo argued for aggressive industrial policies to restore American competitiveness.

Bill Clinton, running on the theme that Americans were “working harder for less,” seemed sympathetic. But for the bankers and brokers who had financed his campaign, globalization was not a threat; it was an opportunity to invest in production where labor was cheap and governments bribable.

As president, Clinton chose Wall Street over Main Street. He deregulated finance, extended privatization, and widened the revolving doors between Democrats and the financial sector. The bargain was sealed when Clinton allied with Republicans in Congress to pass NAFTA (the brainchild of Ronald Reagan), established a World Trade Organization to protect investor rights, and opened up the U.S. market to China.

Republicans and their Chamber of Commerce allies were, of course, fully on board. As they correctly saw, Clinton’s trade policies not only shifted income from workers to investors, but they undercut the most important institutional support for New Deal social democracy—organized labor.

After Barack Obama won the 2008 election as an “agent of change,” he renewed the Wall Street-Democrat alliance, persisting in the trade policies that had decimated the Democratic base in the industrial Midwest.

America’s globalized capitalism can live with the politics of race, gender, and sexual identity. But it is implacably hostile to organized labor. The neoliberal Democrats got the message. As the unionized factories closed and labor’s membership dwindled, the Democratic Party—while it happily took union members’ dues and votes by arguing that Republicans would be worse—did virtually nothing to help.

History, the Democrats discovered, was about demography, not class. Democrats would assemble a coalition of the growth sectors—minorities, women, and professional white men. Like their Wall Street funders, the coalition’s implicit antagonist, if not enemy, was the white male worker—the “loser” in the New Economy.

Ignored in this politics of social and cultural identity was that organized labor, for all its flaws, kept the white working class in the Democratic Party, and was a firewall against white racism. This was especially true for industrial unions. Moreover, factory jobs, along with government jobs, were the most important ladders of upward mobility for minorities and immigrants. In election after election, the best indicator that a white worker would vote Democratic was union membership.

So as industrial unions declined, the right wing punched through that firewall, firing up anger towards elites, whose definition of diversity and equality did not seem to include white “losers.”

As long as Republicans maintained their own aloofness to the working class, that anger had no place to go. But with a Democratic mindset that allowed Rahm Emanuel—the Wall Street fixer who staffed both Bill Clinton and Obama—to tell Obama’s task force on the auto industry bailout “Fuck the UAW!” it should have been no surprise that the Democrats were vulnerable in Michigan—and Ohio, Pennsylvania, Wisconsin, and Iowa.

So when Donald Trump, a man clearly unfit to be president, declared a plague on both political houses, white workers in the industrial Midwest, who had voted for Obama as an agent of change, were his.

Indeed, the election suggests that the Clinton/Obama coalition may not after all be on the right side of history. The current trajectory of the U.S. economy is for continued slow growth and a worsening distribution of income between capital and labor. If so, the politics of class may be more of a political motivator than social diversity, whatever the demographics.

The failure of the expected massive turnout of minorities and the college educated against a bigoted and crass huckster like Donald Trump becomes less of a mystery when you consider this: In the eighth year of the Obama recovery, almost half the electorate would have to borrow or sell something to meet an unexpected expense of just $400.

The success of Bernie Sanders—another unlikely candidate—demonstrated that economic pain and pessimism has already spread far beyond the middle-aged white guys who used to have union jobs. His campaign was energized by millions of young people who face a future of debt, marginal employment, and the relentless offshoring or automation of any jobs that can be done more cheaply abroad or by a computer.

As financially distressed 20-somethings become 30- and 40-somethings—black, brown, or white; male or female; straight or gay—economic class rather than social identity may well be the key to a progressive political future.

The good news is that the assumptions of neoliberal economics are discredited and that policy intellectuals on the party’s left have already thought through the building blocks of a new economic policy agenda. It includes tax, trade, and regulatory changes aimed at shrinking speculative finance and expanding productive investment in America; increasing workers’ bargaining power with stronger unions and workplace protections; and a foreign policy that shifts America from its untenable role as world policeman to one of honest broker for global cooperation on economic stability and climate change.

Moreover, there is core of experienced political leadership in Sanders, Elizabeth Warren, and others who understand what is needed.

The Democrats’ task ahead, therefore, is to return to their own roots as the party of the new working class, whose anxieties about the future are spilling over the walls that separate people of different colors, genders, sexual preferences—and even educations.

This means making higher minimum wages, collective bargaining, and worker health and safety priority issues over the next few years. It also means committing to a coherent strategy for keeping and creating jobs with rising wages in America. By moving fast to preserve roughly half the jobs that the Carrier Corporation was going to ship to Mexico, Trump has already moved ahead of the flat-footed Democrats on this issue. Democrats may sniff that Trump’s grandstanding cannot hold back the tide of globalization, but say that to the grateful Carrier worker who told TheNew York Times, “Now I can put my daughter through college without having to look for another job.”

Still, his pushback at Carrier is a one-trick policy. So Democrats need to keep his feet to the fire on offshoring jobs. Since he can only do this by having government interfere with the right of businesspeople to make their own decisions, it has the potential for splitting Trump from the Republicans, or splitting him from his working-class base.

A pro-worker agenda will of course turn off many of the people who paid Hillary Clinton $250,000 a speech. Democrats therefore need a strategy for weaning the party from big money, starting with overturning the Supreme Court’s decision on Citizen United.

Trump’s victory, however, locks down the Court for the foreseeable future. So, given that overwhelming majorities think that Washington is corrupted by money, this is an issue that could ignite populist energy for the Democrats if they launched a grass-roots campaign to amend the Constitution.

No such campaigns or policies can be led by a policy class that moves from Wall Street to Washington and back, and remains much of the default pool of policymakers poised to return if and when the Trump experiment collapses.

The conventional wisdom is that Trump will tank; his promises contain too many contradictions for him to deliver on them. But Democrats also made that assumption about Reagan, whom they considered over his head when it came to policy. Trump, like Reagan, recites the catechism of fiscal conservatism, but like Reagan, he may turn out to be a Keynesian spender. Certainly he knows enough bankers and brokers to understand that their economic principles are easily bought off with tax cuts and deregulation.

Any Trump stimulus will direct the lion’s share of benefits to the top 1 percent, but enough could trickle-down in the form of tighter labor markets to see a sustained rise in wages. Assuming he keeps his promise to defend Social Security and Medicare, a few dramatic confrontations over trade policy and a battle with the Federal Reserve to keep interest rates low, could cement his populist credentials.

Trump will always have trouble curbing his motor mouth, but he has already demonstrated a prowess for explaining away his failures by scapegoating minorities, immigrants, and liberals. A Democratic Party that cannot look at the economy through the lens of class as well as social identity may be just what he needs to turn Trump into a longer lasting Trumpism.