In what was easily her strongest debate performance in recent memory – and arguably her strongest since the campaign began – Hillary Clinton was calm, cool and collected at Thursday night’s debate.

Clinton could’ve been understandably on edge, as she was fresh off a resounding loss in New Hampshire on Tuesday and an effective tie in Iowa the week before. But it was Sanders who was oddly on the defensive despite what has been momentum in his favor, starting out the night more combative than Clinton and wasting his time on petty one-liners. (When Clinton talked about building political capital when she’s in the White House, for instance, Sanders began a rebuttal with “Secretary Clinton, you’re not in the White House yet.”)

Perhaps it was understandable that Sanders appeared to be on defensive as the major topics of the night – race, foreign policy and relations with Obama – are all considered areas of relative weakness for the income inequality-focused Sanders, though the the depth of his policy knowledge and ability to articulate it before audiences, particularly on race issues, has improved markedly since the campaign began.

Still, as winning over minority voters will be one of the principal areas of focus for both candidates going into southern primaries like the one in South Carolina and polls show that Sanders is struggling to eat into Clinton’s lead in the coming contests, expectations were high for Sanders this debate.

And while both candidates performed well initially in talking about systemic racism and reforming the criminal justice system, it was Sanders who stumbled when a moderator asked if race relations would be better handled under him than the current president. It was a foreseeable trap – asking a white man whether he’d do a better job on race issues than the first black president – but Sanders didn’t seem to see what he was walking into.

“Absolutely,” he said in response to the moderator’s question before slipping into his classic stump speech. “Because what we will do is instead of giving tax breaks to billionaires, we are going to create millions of jobs for low-income kids so they’re not hanging out on street corners. We’re going to make sure those kids stay in school are able to get a college education.”

It was as tone-deaf a line as any all night and, worse yet, it may have reminded Clinton of another line of attack she’d prepared in advance. In an MSNBC interview earlier on Thursday, Sanders had criticized President Obama’s failure to connect with Congress, saying in an interview with MSNBC, “There’s a huge gap right now between Congress and the American people. ... What presidential leadership is about [is] closing that gap.”

From a political analyst’s perspective, it’s a completely valid criticism – but when you’re running in a Democratic primary with an extremely popular Democratic president, it is, well, a weird move.

And Clinton didn’t let him – or the audience – forget about that or other critiques of the president, pivoting near the end of evening to Sander’s frequent criticism of Obama. “I want to follow up on something having to do with leadership” she said, “because, you know, today Senator Sanders said that President Obama failed the presidential leadership test. And this is not the first time.”

Then, without changing her even tone in the slightest, Clinton launched her most vicious attack on Sanders of the debate, running down a list of the times Sanders had called the president “weak” and “a disappointment”. She ended with, “I don’t think [Obama] gets the credit he deserves.”

The argument over Obama’s legacy is one that Clinton’s campaign has been wanting to have with Sanders for some time, and Sanders set her up for an easy hit. Viewers at home watching the candidates on a split screen could see Sanders huffing and puffing as Clinton spoke, laughing angrily to himself and scribbling notes as she spoke. He clearly hadn’t been expecting that line of attack, though he might well have anticipated it. When he finally did get time to respond, he told the woman whom he’d earlier all but accused of accepting campaign donations in direct exchange for political favors that repeating his own words “was a low blow”, indignantly and with no cool whatsoever.

It was a bad look for Bernie – whom the cameras often caught wagging a finger at the moderators while Clinton spoke – and it left him struggling to articulate the reasons for the distance between himself and a popular president, a distance he’d previously tried to wave away before when an interview Obama gave to Politico seemed to suggest that the sitting president favors Clinton over Bernie.

Throughout the debate, on practically every topic, Clinton’s cool demeanor played well. Even on the one topic that should have gotten under her skin – why more New Hampshire women, particularly young women, didn’t vote for her – she resisted the temptation to be or even sound critical.

“I have spent my entire adult life making sure that women are empowered to make their own choices even if that choice is not to vote for me” she said, adding that she hoped that they’d vote their consciences in the primary and learn more about her before the general election.

After Clinton surrogates like Madeleine Albright and Gloria Steinem made the mistake of being insufficiently deferential to younger women last week – possibly costing her at least a few votes – Clinton didn’t have a lot of room to err in her answer, and she didn’t.

It was, instead, her opponent who made the mistake – repeatedly this debate – of being too quick to anger and allowing his feelings to affect his answers. Clinton, who can hardly express an emotion in public without her ability to lead being called into question, didn’t have that luxury, and she didn’t try to indulge in it.

For once, that was an advantage.