As President Trump refuses to concede that he lost the election, and his dead-enders trot out increasingly bizarre conspiracy theories and legal tantrums, we are witnessing an attack on democracy that is at turns sickening and comical. But as it turns more the latter than the former, we should be aware of how close we came to catastrophe.

You may look at President-elect Joe Biden’s 306-to-232 lead in the electoral college, and his popular vote lead of 5.8 million votes and growing, and say that, thankfully, the results weren’t that close. As my colleague Greg Sargent wrote before the election, Trump’s legal strategy was predicated on getting within “cheating distance,” with the margins narrow enough that he could convince Republican judges to intercede on his behalf and hand him the election. It hasn’t happened.

But it was closer than you think. And it raises the frightening possibility that if Trump’s team were not such a bunch of buffoons, and if Republican officials at the state level were just a little more corrupt than they already are, he might have been able to steal the election after all.

That’s because the 2020 election was, in one critical way, even closer than 2016.

You may remember that four years ago, Trump managed to win the electoral college because he prevailed in Michigan, Wisconsin and Pennsylvania by a combined total of just 77,000 votes. That tiny margin was enough to overcome Hillary Clinton’s 3 million-vote lead in the popular vote and make him president with 304 electoral votes.

In the time since, Democrats have cited that number over and over, often as proof of the Clinton campaign’s strategic missteps. How hard would it have been to grab 77,000 more votes? Couldn’t they have done it with a few more visits to those states?

So what’s the analogous magic number for 2020? It’s even smaller.

Final tallies are being completed; Georgia is conducting a hand recount, and there could be a recount in Wisconsin if the Trump campaign decides to pay for one. But here are the margins by which Biden won three critical states, as of Wednesday morning:

  • Arizona: 10,457
  • Georgia: 14,028
  • Wisconsin: 20,565
  • Total: 45,050

If we’re thinking about whether Trump could make up any of those deficits in a recount, the answer is almost certainly no; recounts seldom find mistakes that move more than a few hundred votes in one direction or another, and could just as easily make Biden’s leads larger.

But if Trump had managed to get those 45,000 votes, he would have won 37 more electoral votes, making the electoral college a 269-to-269 tie. Under the Constitution, the election would have then been decided by the House of Representatives, with each state delegation getting just one vote. Even though Democrats have a majority in the House, more state delegations have Republican majorities. Trump would have been reelected.

That’s the bullet we just dodged, all because of 45,000 votes.

Which raises the question of whether Trump might still be able to convince election officials and courts to toss out enough Democratic votes to pull it off.

The answer at this point is plainly no. The simple reason is that there are no grounds to do so and no fraud to be found (despite Republicans’ efforts). The suits they have filed around the country have been almost laughed out of court — but they’re still trying. On Tuesday, the Trump campaign filed suit in Nevada asking that Biden’s 34,000-vote victory simply be nullified and the state’s electoral votes be awarded to Trump or at least given to neither candidate. In Pennsylvania, the increasingly unhinged Rudolph W. Giuliani, appearing in court for the first time in decades, made an utter fool out of himself; as the Associated Press described his performance, “Over the next several hours, he fiddled with his Twitter account, forgot which judge he was talking to and threw around wild, unsupported accusations about a nationwide conspiracy by Democrats to steal the election.”

And in Michigan, the Republican members of the elections board of Wayne County, which includes Detroit, initially refused to certify the results; one of them said that she’d be willing to certify those from cities other than Detroit. It was a momentary lifting of the veil, as the GOP’s belief that the votes of Black people are inherently illegitimate became disturbingly explicit.

After an outpouring of protest, the two Republicans relented and certified the results. But had they been more committed to giving Trump the election at all costs, we could have eventually found ourselves in the situation many feared, in which a state’s Republican legislature simply decided to grant its electoral votes to Trump no matter what the voters wanted.

And if one state’s GOP legislature did it, others might have, too. The legislatures in Wisconsin, Arizona and Georgia are all controlled by Republicans.

At this point, it isn’t going to happen. But what if, say, Trump had won Arizona and Georgia (which would have taken just 25,000 votes combined), and it was all up to Wisconsin? Would the Republican legislators who engineered the country’s most brutal partisan gerrymander have respected the will of the voters enough not to just hand Trump the election?

Fortunately, we won’t have to find out. But the fact that we came so close shows us how fragile this system is. Until we find a way to fix it, we’ll always live with the threat of the kind of stolen election Trump is still hoping he can pull off.

Read more: