Americans tend to focus on external threats to our democracy: foreign adversaries wielding disinformation and subversion. But the most serious dangers have always come from inside the house, products of our own demons and dysfunctions. And if this fact wasn’t clear in the past, it is in the present, as a Trumpified Republican Party reacts to potential defeat in key races by delegitimizing the elections themselves.

The drama of any election night often obscures the banal reality behind voting. Even when winners and losers are clear, it takes time to count ballots. The more people in a state, county, or locality, the longer the process. When elections are close—when they are separated by a few dozen or a few hundred or even a few thousand votes—that process can take days or weeks, as election officials check and recheck every vote cast, from the early, absentee, and day-of ballots to the provisional votes and ballots from abroad. This year, California election officials didn’t call the race for the state’s 48th District, a face-off between incumbent Dana Rohrabacher and Democratic challenger Harley Rouda, until four days after voting. (Rouda won.) In addition to other California races, we’re still waiting on results from congressional races in Georgia, Maine, New Jersey, New York, Texas, and Utah.

The most-high-profile counts are for contests in Florida, Georgia, and Arizona. In Florida, officials are still tallying votes for all three statewide races—governor, U.S. Senate, and agricultural commissioner—which are each close enough to require recounts (The state’s rules dictate a recount when the margin is less than or equal to half a percent.) In Georgia, officials are still counting ballots for the governor’s race, which will go to a December runoff election if Republican Brian Kemp falls below the 50 percent of the votes required to win an election outright. The Arizona Senate race was similarly too close to call on election night, with Republican Martha McSally slightly ahead of her opponent, Kyrsten Sinema, a lead that had reversed in the days after.

The dominating presence of Donald Trump makes it easy to attribute this anti-democratic conspiracy-mongering to his emergence on the political scene. But this impulse has extensive roots in the Republican Party.

As election officials continued the routine process of counting votes, national Republicans, including the president, tried to claim the Arizona count was rigged. Trump tweeted on Friday, “Just out — in Arizona, SIGNATURES DON’T MATCH. Electoral corruption - Call for a new Election? We must protect our Democracy!” Likewise, on CNN, Colorado Sen. Cory Gardner, chair of the National Republican Senatorial Committee, alleged misconduct in Florida, even though the state’s law enforcement has said there’s no evidence of misconduct. And the NRSC itself accused an Arizona official of “destroying evidence to cook the books” for Sinema. To her credit, McSally declined to indulge this rhetoric, and on Monday, when it was clear Sinema had the votes to win, McSally conceded.

A similar progression, from presumptive GOP win to clear Democratic victory, seems possible in Florida, which would compound the party’s already-steep losses in the midterm elections. In response, Republicans are working even harder to delegitimize the count and the recount in the state’s uncalled races. “The Florida Election should be called in favor of Rick Scott and Ron DeSantis in that large numbers of new ballots showed up out of nowhere, and many ballots are missing or forged,” tweeted President Trump on Monday. “An honest vote count is no longer possible-ballots massively infected. Must go with Election Night!”

Florida Gov. (and Republican Senate candidate) Rick Scott has accused Democrats of trying to “steal this election,” called on law enforcement to monitor counting of ballots, and filed a lawsuit against Broward County, seeking access to its ballot records. Trump bolstered his ally with a tweet alleging “Election Fraud,” as if counting and recounting are against the rules and not the proper order of things.

The dominating presence of Donald Trump makes it easy to attribute this anti-democratic conspiracy-mongering to his emergence on the political scene. But this impulse has extensive roots in the Republican Party. You see it in everything from the delegitimization campaign against Bill Clinton to Bush v. Gore and the successful effort to end an uncertain recount and declare George W. Bush the winner of the presidential election despite contested ballots.

There’s an underlying attitude as well: that Democratic politicians—and Democratic constituencies—can’t be legitimate wielders of power. We saw it in the backlash to President Obama, which included accusations—pushed by then–reality-television star Donald Trump and taken up by some Republicans—that he was foreign-born and thus ineligible for the White House. On a smaller but still significant scale were the actions of North Carolina Republicans, who immediately moved to strip the governor’s office of power after Democrats won the office from GOP control. Wisconsin Republicans are primed to do something similar after Gov. Scott Walker fell to Democratic challenger Tony Evers on election night. If Trump is different, it’s only that he’s more shameless.

It is normal for political parties to be vigilant and aggressive about their electoral interests. But Trump and the GOP have gone beyond ordinary vigilance to something like an attack on the integrity of American elections themselves. What they want is for Florida officials to just stop counting votes—and to hand the election to the Republican Party regardless of the actual outcome. They’re willing to undermine the public’s trust in the election process to achieve that end. This is a dangerous game. Democracy depends on the legitimacy of the process for winning and exchanging power. Once lost, that legitimacy is difficult to recover.

President Trump, with his narcissism and deep-seated authoritarian instincts, doesn’t care about the survival of institutions. He will do anything to notch a win and satisfy his need for praise and validation. And ordinary Republican politicians have either embraced or turned a blind eye to these tactics. Even “Never Trump” dissenters like outgoing Arizona Sen. Jeff Flake or Nebraska Sen. Ben Sasse have shown little objection to vote suppression or other attacks on the integrity of the election process from their own party. If there was a sense of fair play among Republicans, it has all but withered into vestigial irrelevance.

Since 2016, the most-talked-about threat to American democracy has been Russian interference and subversion, meant to heighten division and delegitimize electoral outcomes. But the most serious threat sits in the White House, telling his supporters that the game is rigged and their political opponents are illegitimate. This will not end with Florida. If Trump faces a tough fight for re-election, you can expect him to run this play again, bolstered by his Republican allies. And if he loses narrowly, this episode may presage his reaction: not to concede, but to resist.