With his campaign flailing in the final stretch of the race, Donald Trump refused to endorse the legitimacy of the presidential election during Wednesday night’s presidential date, telling moderator Chris Wallace that he could not commit to recognizing its results.

“I will look at it at the time,” the Republican nominee said, adding, “I’ll keep you in suspense.”

Blaming the media for slanted coverage and saying that his Democratic opponent, Hillary Clinton, should not have been allowed to run for president, Trump refused to commit to a peaceful transition, even as Wallace tried to explain to him that it was a bedrock principle of American government.

“This is how Donald Trump thinks,” Clinton said. “It is funny, but it is also really troubling. This is not how our democracy works. We have been around for 240 years. We have had free and fair elections. We have accepted the outcomes when we may not have liked them, and that is what must be expected of anyone standing on a debate stage during a general election.”

Trump’s refusal to endorse a core principle of American democracy, on stage during a general-election debate with much of the country watching, might be the weirdest, and most disturbing, moment yet in a campaign marked by breathtaking violations of protocol and decorum. Faced with accusations from his critics on both the left and the right that he is a wannabe tin-pot dictator, Trump rose to the occasion, determinedly confirming the attack. It was perhaps the most irresponsible thing ever said during a general-election debate.

That exchange, more than an hour in, was just one of several nasty moments that made this the tensest of the three debates. But in many ways, it followed the pattern of its two predecessors: Trump was irritable, blustery, and spouted dishonest statements. Clinton, meanwhile, was workmanlike and studious, and found herself occasionally on the defensive over her email server and hacked messages released by WikiLeaks. In general, she seemed content to play it conservative, holding on to what most polls find as a strong lead, rather than aim for a knockout blow. Trump delivered his most substantive and detailed performance, and landed a few solid blows, but as in previous debates, his erratic behavior overshadowed them.

The Republican has a habit of turning insults and criticisms back on his critics. When Clinton argued that Trump was too close to Russian President Vladimir Putin and would be a puppet, he sniped, “No, you’re the puppet. No, you’re the puppet.” When she questioned his unfitness for office, he replied, “No, you are the one that’s unfit.” Late in the debate, as she answered a question, he said, “Such a nasty woman.” At other times, he tangled with Wallace. Clinton, for her part, repeatedly tried to run over Wallace’s attempts to keep her to time limits, speaking over him.

It took 50 minutes for the issue of allegations of sexual assault against Trump to come up, and Wallace arguably did Trump a favor, setting it up as a contrast between those allegations and past allegations against Clinton’s husband Bill. Trump said, falsely, that the allegations had been debunked, then tried to pivot hard to videos released by conservative muckraker James O’Keefe that purport to show Democratic operatives bragging about inciting violence. Clinton, who surely expected such a question, turned directly back to the assaults.

“Donald thinks belittling women makes him bigger,” she said. “He goes after their dignity, their self-worth, and I don't think there is a woman anywhere who doesn't know what that feels like. So we now know what Donald thinks and what he says and how he acts toward women. That's who Donald is.”

“No one respects women more than I do,” Trump answered—eliciting open laughter from the audience in Las Vegas.

Clinton kept pushing, bringing up Trump’s past attacks on New York Times reporter Serge Kovaleski, Judge Gonzalo Curiel, Senator John McCain, and Khizr and Ghazala Khan. “Every time Donald is pushed on something, which is obviously uncomfortable, like what these women are saying, he immediately goes to denying responsibility, and the not just about women,” she said. “I’d love to talk about other things,” Trump said, a moment of frankness. Perhaps that was unwise, though—within minutes, he had refused to endorse the legitimacy of the election.

For a few minutes at the start of Wednesday’s third presidential debate, it seemed like voters might actually get a substantive look at policy from the two candidates. The first question, to Clinton, was about how she would approach Supreme Court appointments, delivering a straightforward description of a liberal court that would defend Roe v. Wade, rule against major companies, and reverse the Citizens United case. Then Trump was up. He began with a swipe at Justice Ruth Bader Ginsburg, criticizing her for attacking him (she did) and his supporters (which she did not). When Wallace asked him directly whether Roe would be overturned under a Trump presidency, he tried to dodge the question, finally saying that with the justices he picked, it “inevitably” would be. But Trump quickly attacked Clinton for backing late-term abortions. She fired back that he was using “scare rhetoric” and pledging to protect the right to choose—contrasting the U.S. with countries with forced abortion or forced pregnancy.

So far, so good—or at least as good as could be hoped. Next up was immigration. Trump delivered one of the more memorable lines of the night, justifying mass deportations by saying, “We have some bad hombres here and we have to get them out.” Trump made a curious, quietly effective argument that Clinton, who voted for border security, and Obama, who has deported millions, were stronger on immigration that Trump had previously suggested.

Wallace asked Clinton about a speech to a Brazilian bank in which she said that she favored “open borders.” Clinton insisted that she was referring only to electricity markets—a statement that seems hard to support based on the transcript. She quickly tried to pivot, complaining that the hacked emails, revealed by WikiLeaks were a Russian plot, as U.S. intelligence officials have said. Trump said he did not know Putin, and he complained—in an echo of the 1960 election—of a missile gap with Russia.

“I find it ironic that he's raising nuclear weapons,” Clinton said. “This is a person who has been very cavalier, even casual, about the use of nuclear weapons. Trump insisted she was wrong: “There's no quote. You're not going to find a quote from me.” He was, yet again, lying. In April, in an interview with Wallace, Trump said, " So, North Korea has nukes. Japan has a problem with that. I mean, they have a big problem with that. Maybe they would in fact be better off if they defend themselves from North Korea." Asked by Wallace whether that included nuclear weapons, Trump said, "Including with nukes, yes, including with nukes.”

As has often been the case, Trump is most effective when talking about his opposition to existing free-trade agreements, one of his core arguments. He worked to tie Clinton to NAFTA.

“I pass factories that were thriving 20, 25 years ago. And because of the bill that her husband signed and she blessed 100 percent, it is just horrible what's happened to these people in these communities,” he said. “She can say that her husband did well. But, boy, did they suffer, as NAFTA kicked in, because it didn't really kick in very much. But it kicked in after they left. Boy, did they suffer.”

Clinton, for her part, accused Trump of outsourcing jobs, employing undocumented workers during the construction of Trump Tower, and using cheap Chinese steel to build his own hotels in the U.S. She vowed to not add a single penny to the national debt with her economic-stimulus plan.

Everything from Trump’s filibuster on electoral legitimacy felt a little anti-climactic. The candidates went through pro forma discussions of foreign-policy hot spots, for the most part reiterating past positions. At the end of the debate, it was no great surprise when the candidates did not shake hands.

The end of the election is looking equally anticlimactic. With less than three weeks to go, Trump is falling behind in the polls. While debates are seldom good places to change the momentum of the race, it was one last chance for Trump to impress upon a huge national audience his readiness for the presidency; instead, he chose to question the very enterprise he wishes to run. If he loses on November 8, there’s no reason to expect a friendlier denouement to the election than there was to Wednesday’s debate.