America is a divided nation — and the presidential campaign only made the condition worse.

Partisanship has spiked. Armed militias showed up at campaign rallies. Gun sales soared.

In New York, Los Angeles, Washington, D.C., and other cities, shop owners nailed plywood over their windows. In a Gallup Poll last month, a record 64% of people said they were "afraid of what will happen" if their favored candidate doesn't win.

"You just don't want to talk to people anymore," Mary Jo Dalrymple, a 56-year-old retiree in Greensburg, Pennsylvania, told me. "You're afraid it will be unpleasant."

This isn't normal — not in decades, perhaps not since the Civil War.

Even with nearly a quarter-million deaths, and 100,000 infections a day, our most durable problem isn't the COVID-19 pandemic; a vaccine can solve that. Nor is it the recession; the economy likely will recover once the virus is quelled.

Our biggest challenge is the political polarization that has made the country increasingly ungovernable, no matter who wins.

Polarization has been part of our politics for decades. But under President Donald Trump, it has turned into something worse: delegitimization — the practice of condemning your opponents as un-American, undemocratic and unworthy of respect.

Trump entered politics by questioning President Barack Obama's legitimacy, suggesting falsely that he might not be a U.S. citizen. This year, he charged — again without evidence — that Democratic nominee Joe Biden was mentally and physically infirm and the puppet of "radical socialists" who "hate our country."

On the other side, plenty of Democrats believe Trump is a would-be authoritarian who would gladly destroy the Constitution.

At their first debate, Biden called Trump "one of the most racist presidents we've ever had," overlooking the fact that 12 of the first 18 presidents owned slaves.

Many Democrats and Republicans see the other side not merely as political rivals, but as an existential threat. That creates a dilemma: If you think your opponents don't share a basic commitment to constitutional government, why would you work with them?

That problem won't disappear once the election is over. Unless one party captures both houses of Congress and the White House, it will stand in the way of the next president accomplishing anything.

In my view, here's what needs to happen.

Step One is making sure the election is seen as legitimate. Partisans on both sides think their opponents are trying to cheat — a sentiment stoked, of course, by Trump's constant declarations that the voting process is "rigged" and his refusal to promise a peaceful transition of power if he loses.

A president who wins by underhanded means will rightly appear illegitimate. He may claim a mandate, but he won't have one.

The runner-up needs to acknowledge reality and give a concession speech — the more graceful, the better. That's how the losing side acknowledges that the winner is legitimate. If the losing candidate refuses to do it, other leaders in his party should do it for him.

Step Two is working to bring the country together, as earlier presidents did after divisive campaigns.

That means a serious attempt to revive bipartisan deal making in Congress, starting where the two parties share similar goals — another economic relief bill to help the country through the pandemic, for example.

It also requires granting your opponents the presumption of legitimacy, no matter how much you dislike their policies.

Biden, who spent 36 years in the Senate, has already said he would try to work with Republicans in Congress if he's elected. Progressive Democrats have sniffed that his nostalgia for a long-ago era of comity is naive.

But Biden knows how the modern Senate operates. He was vice president when Obama tried and failed to win GOP support for an economic stimulus bill in 2009 and for an immigration reform package in 2013.

His talk of bipartisanship may have been a campaign gambit; swing voters like the idea of the two parties working together. It may even be aimed at splitting moderate Republicans from Trump loyalists. Even so, it's worth a try.

It's now almost forgotten, but Trump was elected in 2016 in part because he promised, as a businessman, to work with both parties.

In his first year in office, he tried to cut deals with Democrats on immigration reform and infrastructure spending. As recently as last week, he was negotiating with House Speaker Nancy Pelosi — at arm's length, to be sure — over a possible stimulus bill.

Even if the results are modest, a bipartisan effort would be an encouraging departure from gridlock. A president who gets things done — as opposed to merely insulting his critics — could see his legitimacy and his popularity grow.

It's been done before: Ronald Reagan did it in the 1980s; Bill Clinton did it in the 1990s; George W. Bush did it in the early 2000s after a disputed election that was decided in the Supreme Court.

If the next president hopes to leave a substantive legacy, he should follow those presidents, work to stem the tide of polarization that has poisoned our politics, and make America's government work again.

Doyle McManus is a columnist for the Los Angeles Times. E-mail: doyle.mcmanus@latimes.com.