At the end of Wednesday’s third presidential debate, Donald Trump said something so awful that it disqualifies him from ever holding any political office, let alone the position of commander-in-chief. Repeatedly prodded by moderator Chris Wallace to answer the question of whether he “will absolutely accept the result of this election,” Trump kept dodging and finally said, “I’ll keep you in suspense, okay?” It was a fundamental assault on a bedrock principle of democratic society. As Hillary Clinton rightly said, Trump’s remarks were “horrifying.”

This moment was the climax of the three debates—Trump’s final act of petulant self-destruction, and Clinton’s final moment of calmly smiling triumph—and it didn’t spring from accident or purely from Trump’s own anti-democratic malevolence. Rather, this moment—the one in which Trump revealed himself to be someone who is willing to risk the tradition of a peaceful transition of power rather than accept that he’s lost—came about because of the masterful way Clinton has handled all three debates.

In her acceptance speech at the Democratic National Convention, Clinton said that Trump was someone so weak that he could “be baited with a tweet”and in the debates she proved, again and again, that he can be baited by a sharp, quick-witted woman too. Her constant trolling, which involved maintaining a steely resolve in the face of his own slimy provocations, won her the debates and settled the most fundamental question of the election: Who has the temperament to be president?

The question was key because both candidates are unconventional for different reasons—Trump because of his background in business and entertainment rather than politics, and Clinton because she’s a woman making a bid for a position that has only been held by men for more than two centuries. Over the course of three debates, Clinton has decisively won the temperament question, not only by remaining calm and unflappable but also by provoking her rival to constantly act in peevish and even childish ways. This pattern was set in the first two debates, but in Wednesday’s third and final debate, Clinton overcame Trump’s half-hearted attempt to put forward a more sober public face, thus underlining her victory. The cumulative effect of the way she handled the debates clinched the election for her, and set her on a path to a landslide.

There’s been a powerful gender subtext running through all the debates. As a pathbreaking woman proving herself in a man’s world, Clinton used the familiar strategy of women in this situation of studying hard and being as professional as possible. Trump, by contrast, was constantly reverting to his natural state of toxic masculinity. It’s not uncommon in the corporate world for a well-prepared woman to compete against a man who thinks he can wing it. That was the fundamental dynamic of the presidential debates.

Yet thanks to her hard work and Trump’s fecklessness, Clinton ended up displaying all the traits that men are traditionally supposed to have for the presidency—the steadiness, the unflappability, the steeliness under pressure and assault. He came across with traits of a stereotypical “female,” all the reasons they were once thought to be “unfit” for jobs like this. He couldn’t control his emotions, he personalized everything, he whined. You almost came out of these debates thinking, “Are men fit to be president?” She “proved” a woman is fit, and how she reduced him to acting like a little boy (or, more in popular stereotype, like a girl).

Earlier in the week, Melania Trump had defended her husband’s behavior in the infamous “Access Hollywood” video where he boasted of sexual assaults by saying that the Republican nominee was basically a big child. As she told Anderson Cooper, “I have two boys at home, I have my young son and my husband.”

Hillary Clinton’s genius in the debates has been to constantly troll Trump into reverting to that intrinsic state of childishness—most memorably when he muttered “such a nasty woman” toward the end of Wednesday’s debate, while Clinton was answering a question about entitlements. His peevishness left her by default as the adult in the room. By constantly being above it all, smiling as he engaged in insults, keeping calm while he hovered behind her in the second debate like a would-be stalker, she proved she had presidential mettle. Her steel nerves and unflappability, which had earlier been displayed in the marathon grilling of the Benghazi hearings, were deeply impressive.

During the first 20 minutes on Wednesday, Trump was remarkable sober—sedate, even—but Clinton quickly provoked his easily wounded amour propre by bringing up Trump’s praise for Putin and the claims by intelligence agencies that the Wikileaks revelations about her email probably came from Russian government hacking. This was a double victory, because it moved the topic away from Trump’s signature issue of immigration—and Trump, as usual, couldn’t resist the bait.

Clinton’s “Putin trap” was what finally set Trump off for the rest of the debate, beginning the downward spiral that ended with his disastrous comments about not accepting the results of the election:

Trump: Now we can talk about Putin. I don’t know Putin. He said nice things about me. If we got along well, that would be good.

If Russia and the United States got along well and went after ISIS, that would be good. He has no respect for her. He has no respect for our president. And I’ll tell you what, we’re in very serious trouble because we have a country with tremendous numbers of nuclear warheads, 1,800, by the way, where they expanded and we didn’t — 1,800 nuclear warheads, and she’s playing chicken. Look —

[Crosstalk]

Clinton: Well, that’s because he’d rather have a puppet as president.

Trump: No puppet, no puppet.

Clinton: And it’s pretty clear --

Trump: You’re the puppet.

The “you’re the puppet” retort took the debate back to grade-school level, where it’s considered witty to to say “I know you are, but what am I?” Soon thereafter, Trump was testily arguing with moderator Chris Wallace while refusing to concede Russian involvement in the leaks even as a hypothetical:

Trump: She doesn’t like Putin because Putin has outsmarted her at every step of the way.

Wallace: Mr. Trump --

Trump: Excuse me.

Wallace: Mr. Trump --

Trump: Putin has outsmarted her.

Wallace: Mr. Trump, I do get to ask some questions.

Trump: Yes.

Wallace: I would like to ask you this direct question. The top national security officials of this country do believe that Russia is behind these hacks. Even if you don’t know for sure whether they are, do you condemn any interference by Russia in the American election?

Trump: By Russia or anybody else.

Wallace: You condemn their interference?

Trump: Of course I condemn. Of course. I don’t know Putin. I have no idea —

Wallace: I’m not asking you that.

Trump: This is not my best friend. But if the United States got along with Russia, wouldn’t be so bad.

Through the remainder of the debate, Trump displayed childish peevishness, constantly interrupting Clinton by saying “wrong.” He’d been making wild accusations all night—the accusations of sexual assault made against him, for example, were “probably or possibly started by her.” But toward the end, his inner child had taken over: “She totally lied and they fact checked and said I was right.”

Those last three words—“I was right”—sum up what made Trump seem so unpresidential. Everything was always about him, as it is for any small child. By contrast, when Clinton talked about the sexual-assault issue, she opened it up to being about American society as a whole, “what kind of country we want.”

To paraphrase Michelle Obama, Hillary Clinton “went high” by acting like an adult during the debates, which consistently brought out a low response from Trump, showing his inner child. Which is why these debates have clinched the election for her, barring something unimaginable. While Trump might have thought he scored a point by saying she’s “such a nasty woman,” the actual upshot of the debates was to prove she’s ready to be president.