From the vantage point of President Trump and the White House, the fate of Supreme Court nominee Brett M. Kavanaugh unspooled Thursday like a play in two acts.

In the opening scene, sitting center stage in the chilly Senate Judiciary Committee hearing room, was Christine Blasey Ford, who has accused the president’s Supreme Court nominee of sexual assault when he was 17.

Her voice at times tentative and quavering, her face earnest and uncertain, Ford calmly delivered several hours of gripping testimony, declaring at one point that she was “100 percent” certain that Kavanaugh was the prep school boy who had sexually assaulted her so many years ago.

And as she spoke, a grim sense of fatalism descended over Trump and his orbit. The president and his team initially monitored the proceedings on cable news as they flew back to Washington from New York on Air Force One. Save for a few muted grumbles that Ford was lying, the flight was largely silent as aides — both in the air and already on the ground at the White House — watched her testimony with a sinking feeling, said several people familiar with the somber mood, speaking anonymously to share a candid assessment.

They worried that Ford came off as compelling and credible, and began talking as if Kavanaugh’s nomination would fail. Some wondered aloud if the White House should pull him from consideration, while others began to craft a backup plan to urge the president to make a new selection — ideally, a woman.

Trump did not like the format, the female attorney the Republican senators had brought in from Arizona to question Ford or the general unfurling of the morning session, according to one Republican in touch with the White House. “He was absolutely furious,” this person said, speaking on the condition of anonymity to candidly share the president’s frustrations.

But then, at exactly 3:10 p.m., the curtain opened on the second act: Kavanaugh was sworn in, and just like that, the mood inside the White House abruptly shifted from bleak to bullish.

Kavanaugh came roaring in, delivering the majority of his 45-minute opening statement at a volume level just shy of full shout. By turns red-faced and teary-eyed, he jettisoned his wooden performance Monday evening on Fox News for one full of passion as he fought for a seat on the Supreme Court.

Earlier in the week, Trump had privately told aides and confidants that he was disappointed in Kavanaugh’s Fox News interview, which he’d viewed as lackluster and weak, and was eager to see his nominee mount a forceful and indignant defense of himself. In a news conference Wednesday, Trump had even signaled that he might be open to pulling Kavanaugh’s nomination if he found Ford’s testimony convincing.

Kavanaugh delivered on the president’s directive, decrying what he called “a calculated and orchestrated political hit,” an utter “circus,” and “revenge on behalf of the Clintons.”

“You may defeat me in the final vote, but you’ll never get me to quit,” Kavanaugh said. “Never.”

The shift in confidence among White House staff and Kavanaugh allies seemed to spring almost entirely from the tone the judge set in the early moments of his opening statement, rather than the substance of his answers — which included explaining what he said was a crude term for flatulence and a drinking game known as Devil’s Triangle.

Pressed by Sen. Sheldon Whitehouse (D-R.I.) on his descriptor in his high school yearbook as the “Beach Week Ralph club, biggest contributor,” Kavanaugh claimed that his vomiting during the week-long festival of bacchanalia was likely the result of his general gastrointestinal sensitivities.

“Probably refers to throwing up,” Kavanaugh said. “I’m known to have a weak stomach and always have.”

For a White House that Thursday morning had grown increasingly nervous about standing by Kavanaugh, aides said they appreciated his newfound spirit.

In the White House — where aides spent much of the time huddled in offices consumed by the drama unfolding on their flat screens — another official described the mood as relieved.

Trump himself was “riveted,” according to a person close to the president who was not authorized to speak publicly. Praising Kavanaugh’s defiant opening remarks, the president crowed to people in his inner circle, “This is why I nominated him!”

At a fundraiser at his hotel Thursday, Trump said Kavanaugh “knocked it out of the park” and called the hearing “painful” to watch. He did not comment on Dr. Ford, the attendee said.

White House aides and Trump allies had also worried that Kavanaugh’s initial defense — in which he portrayed himself as a veritable choirboy whose high school experience was full of service projects, sports and platonic friendships — could backfire, leaving him with no wiggle room to explain away what they hoped was immature but innocent teenage behavior.

As if in response to those concerns, Kavanaugh on Thursday seemed to offer a more nuanced portrait of his high school years, at several points admitting that he enjoyed the odd drink or two.

“I liked beer,” he said. “Still like beer. We drank beer.”

As the nominating process went on, Trump had publicly and privately expressed his mounting frustrations with Senate Majority Leader Mitch McConnell (R-Ky.), calling McConnell at least twice on Thursday, according to a person familiar with the calls, including after Kavanaugh’s opening statement.

“It’s nice to see a conservative man fight for his honor and his family against a 35-year-old claim with ZERO evidence and lots of holes that amounts to nothing more than a political hit job by the Dems,” Trump Jr. wrote. “Others in the GOP should take notice!”

If Republican and White House confidence began with Kavanaugh’s star turn, a brief but blazing cameo by Sen. Lindsey O. Graham (R-S.C.) midway through the afternoon session punctuated the mounting drama.

His face reddening and his voice rising as he wagged his finger at the Democrats on the dais, Graham hissed, “This is the most unethical sham since I’ve been in politics.”

Moments later, turning his attention to his own party, he continued: “To my Republican colleagues, if you vote no, you’re legitimizing the most despicable thing I have seen in my time in politics.”

Graham’s tirade was well-received inside the West Wing. “@LindseyGrahamSC has more decency and courage than every Democrat member of the committee combined,” White House press secretary Sarah Huckabee Sanders wrote Thursday afternoon on Twitter. “God bless him.”

Of course, the finale is yet to come, another two-part set piece when the Senate Judiciary gathers Friday to vote Kavanaugh out of committee and then again when the entire Senate votes.

Trump’s options are somewhat limited, White House and Capitol Hill aides say. The key votes — Sens. Susan Collins (R-Maine), Jeff Flake (R-Ariz.), Joe Manchin III (D-W.Va.) and Lisa Murkowski (R-Alaska) — are not easily swayed by the president, these people say. At least some of these members have received calls from former president George W. Bush in recent days, aides say.

But on Thursday evening, Trump offered an indication of where he felt the nomination was headed.

About 30 minutes after he was initially expected to depart for a fundraiser, Trump — still at the White House — weighed in on Twitter.

“Judge Kavanaugh showed America exactly why I nominated him,” the president wrote. “His testimony was powerful, honest, and riveting. Democrats’ search and destroy strategy is disgraceful and this process has been a total sham and effort to delay, obstruct, and resist. The Senate must vote!”