The big question going into the first debate of the presidential election was whether Donald Trump would decide to tone down the cartoonish, belligerent alpha male shtick that has carried him this far. The debate gave him an opportunity to present himself unfiltered to an audience predicted to rival that of a Super Bowl, and to reinvent himself as a calmer, more coherent candidate for the benefit of the unusually large number of undecided voters up for grabs.

If that was the plan, he didn’t have the self-control to pull it off; perhaps he didn’t even try. And in the end, the tens of millions of people who ultimately tuned in were given a stark view of Trump’s deep – many would say disqualifying – flaws.

He had clearly failed to prepare adequately for the occasion. He was unable to grasp with even moderate seriousness the issues, even when it came to his own proposals, and what positions he did articulate frequently appeared incoherent. He also repeated untruths on which he has previously been corrected – to put it bluntly, lying.

But perhaps the strongest impression he made was in how he carried himself: ranting, hectoring, often shouting. If part of the test was whether the candidates “looked presidential”, it was glaringly obvious by the end that a Trump presidency would radically redefine what that means.

Hillary Clinton’s main task, meanwhile, was to turn the spotlight on Trump’s past sins and to try to provoke him into an intemperate reaction, all without seeming supercilious. It was a slow burn over the course of the debate’s more than 90 minutes, but by the end she had certainly put Trump under pressure and visibly got under his skin.

It was perhaps impossible to avoid a touch of condescension, such was the gulf in knowledge and capability between the candidates. Whether the voters will hold that against her, we shall see – but the gap between the two could not have been more apparent.

The cracks appear

Things actually started in somewhat subdued fashion. As is her trademark, Clinton came out of the gate like someone carrying several binders of preparation in her head, running gamely thorough a list of proposals – employee profit-sharing schemes, the importance of women’s work, paid family leave, debt-free college attendance, and the need to ensure the wealthy pay their fair share of tax.

Trump, also invited to open on the economy, accused China and Mexico of stealing American jobs. It wasn’t coherent by any normal standard, but he did sound a clear anti-trade note consistent with a core campaign theme.

This seemed to set the stage for exactly the debate many had predicted: Clinton vastly superior on range and detail, but failing to connect; Trump shallow and crass, but perhaps sending a clearer and more emotionally engaging signal.

It was enough to make some of those who consider Trump a terrifying threat shift a little nervously in their seats. And then his slow-motion meltdown began.

After some exchanges on trade in which Trump at least stuck to his message, Clinton took her first big swing, needling him on his failure to release his tax returns – as all other modern presidential candidates have.

Hitting her stride, she rattled off a list of the possible reasons Trump would keep them under wraps: that he is not as rich, or as charitable, as he claims; that he doesn’t want to reveal how much money he owes and to whom; or that he pays no federal income tax at all. Whatever the reason, she suggested, “It must be something really important, even terrible he’s trying to hide.”

Trump was stumped. At one point, he even interjected to apparently acknowledge that indeed he didn’t pay federal taxes and that that made him “smart”. He tried to pivot to the lingering topic of Clinton’s controversial use of a private email server while at the State Department, but she deflected that with a simple and direct expression of regret – and Trump duly set off on another tangent never to return to the email theme again.

Clinton followed up swiftly with a hard attack on Trump’s six corporate bankruptcies, and the long line of contractors he has failed to pay for their services over the years.

A new dynamic had taken hold: Clinton was sharp and on the attack, Trump was rattled and incoherent.

Asked to discuss race relations and policing in America, Clinton reached out to African-Americans while also seeking the presidential high ground: “Everyone should be respected by the law, and everyone should respect the law.” For his part, Trump returned to the theme of his dystopian convention speech, “law and order”, before proceeding to tout his endorsement from the Fraternal Order of Police, lament the abolition of much-hated “stop-and-frisk” policies long associated with racial profiling, and raise the spectre of criminal gangs of illegal immigrants roaming the streets.

It would be hard to construct a monologue more likely to alienate African-American and Latino voters.

Later, Trump was asked to address his former leading role in the “birther” movement that for years variously implied and insisted President Obama was not born in the US. Predictably, he dissembled – and Clinton helped seal the tomb of Trump’s relations with minorities. Calling birtherism a “racist lie”, she also took the moment to remind viewers that Trump had “a long record of engaging in racist behaviour”, dating back to discriminatory practices in his property business in the 1970s that attracted the attention of the justice department.

The denouement

The climax of the debate came, however, when the debate turned to foreign policy. At first, it seemed to revert to type. In a riff on cybersecurity, Russia and terrorism, Trump threw out vague assertions that current policy was a failure and that Clinton had been around for a long time but solved no problems; Clinton came off knowledgeable, if a little dry.

Trump did seem to be losing the thread somewhat, as an answer supposed to be about addressing domestic sources of terrorism – and responding to Clinton’s assertion that it was important to show all Muslims respect – turned into a free-associative ramble regarding NATO, the Iranian nuclear deal, Japanese car imports, and plenty else besides.

But it was when moderator Lester Holt pressed Trump on whether or not he had lied about being opposed to the Iraq War before it occurred that something in him seemed to snap. He set off on an epic rant that deserves to be remembered as one of the most spectacular meltdowns in the history of presidential debate.

His voice rose to a fully-fledged shout as he asserted again and again, losing his composure entirely, that his version of events was true. Bizarrely and repeatedly, he directed his questioners to ask Fox News presenter (and avowed Trump supporter) Sean Hannity to testify to their past conversations on the subject. The rant seemed to go on forever, as moderator and opponent looked on silently.

In response to the next question, the steam from his loss of composure still rising, Trump declared, straight-faced: “I think my strongest asset, maybe by far, is my temperament.” Clinton laughed audibly, and the audience joined in. The most telling point of the night had been made. As the debate shortly turned to nuclear weapons, Clinton barely had to lift a rhetorical finger to remind the audience of the risks of turning over the codes for launch to someone so easily baited.

From that point, the deflating atmosphere of failure seemed to hover around Trump’s performance. He launched an attack on Clinton’s “stamina”, but she responded by listing the three-figure number of countries she visited as Secretary of State.

The moderator raised the topic of Trump’s previous comments about her “look”, and Clinton reminded the audience of Trump’s history of referring to women as “pigs, slobs and dogs”, even managing to work in the repulsive story of his calling a Latina pageant contestant, now an American citizen, “Miss Housekeeping” – a slur that won’t have been lost on Hispanic voters nationwide.

By the end of the debate, it was clear Trump had been defeated. First he was knocked off balance by a simple recitation of the facts of his own past, then he was provoked into a total loss of composure on live TV while applying for a job in which calm judgement is the absolute prerequisite. And finally, he was buried by a reminder of his rank sexism and racism. Clinton performed skilfully, but in the final analysis, he did it to himself.

As of today, there can no longer be any legitimate argument that voters are unaware of what kind of man Donald Trump is. He has been exposed, in the full glare of the public spotlight, as unqualified, unprepared and unfit for office. The only question is whether the American people will be responsible enough to act on that knowledge.