Shortly after Democrat Doug Jones wrested back one of Alabama's solidly Republican Senate seats for the first time in more than two decades, President Donald Trump offered an optimistic and forward-looking assessment on Twitter, congratulating Jones on his "hard fought victory."
But by Wednesday morning, as Trump watched the unflattering portrait of the loss unfold on television, the president grew piqued at the notion that he, somehow, was responsible.
"I won Alabama, and I would have won Alabama again," Trump said, according to a senior administration official.
He told advisers he didn't want the results to be seen as a referendum on him, and asked if he still had a solid base of support in the state. He also questioned Wednesday if he had made the right decision and if Sen. Luther Strange - the Republican he begrudgingly endorsed who went on to lose the party's primary - could have beat Jones in the general election.
But inside the West Wing, Jones' upset victory left some of Trump's top advisers worried about both the 2018 midterm elections and the president's low popularity, and accelerated an already ongoing discussion about restructuring the White House political operation.
This portrait of the White House after the Alabama loss comes from 20 senior officials, aides, lawmakers and outsider advisers and confidants, many of whom spoke anonymously to offer a more candid assessment.
The president himself spread the blame. He faulted his former chief strategist, Steve Bannon, for selling him what one outside adviser described as "a bill of goods" in urging him to support Moore, and he faulted Moore himself for being an abysmal candidate.
In the lead-up to Tuesday night, he had also groused about Senate Majority Leader Mitch McConnell, R-Ky., saying he had been too aggressive in trying to push out Moore.
But the president, White House officials said, was in largely good spirits - surprisingly so, some thought - throughout the day. He called Jones to offer him congratulations and discuss areas were the two could work together.
He also spent much of the day in preplanned briefings and meetings about the Republican tax bill, and was excited about his afternoon speech extolling the plan - which helped shift his focus away from the Alabama loss.
Exit polls Tuesday in Alabama, which Trump won handily last year, showed him at only 48 percent approval. One adviser said Trump on Wednesday dismissed his poll results in Alabama and nationwide by saying they were "fake" and instead talked about his accomplishments.
Nonetheless, some in Trump's orbit said they expected to see adjustments in the coming weeks.
Even before Tuesday's upset loss, the White House had been engaged in an ongoing internal discussion about beefing up its political operation, currently led by political director Bill Stepien.
Stepien's reputation within the West Wing is mixed. Some believe he is unqualified for the job; others say he is capable and liked by Chief of Staff John Kelly, but entered the post without the power or clout to execute his vision.
And Kelly, while respected, lacks the background and experience to play the role of Karl Rove for George W. Bush or David Axelrod for Barack Obama, and Trump does not trust his political instincts, aides said.
A senior administration official, however, argued that Trump often acts as his own senior strategist and the White House doesn't necessarily need an official political cranium.
The White House is especially aware that the president faces a more daunting political task, in part because the outside groups designed to support him have been noticeably ineffective. The goal now is to create a political brain trust that is "more sustained, more organized, more nuanced," a senior administration official said.
One option being considered is bringing on an additional senior adviser who could serve as the White House's top political strategist. Stepien is unlikely to be fired, but Rick Dearborn, a deputy chief of staff whose portfolio also touches on the political operation, is expected to be reassigned to the Department of Commerce, officials said. Recently, Dearborn has met with top Commerce officials about his likely new job.
White House press secretary Sarah Huckabee Sanders rejected the notion that any future staff changes to the political shop indicate dissatisfaction. "This is something that is normal and would be expected in any White House as we move closer to the midterm elections, to beef up the political operation," she said. "This is not a reflection of shortcomings of the current political office."
Yet people close to the White House pointed to the appearance by Sen. Richard Shelby, R-Ala., on CNN's "State of the Union" two days before the election as an example of the challenges the political operation is facing. Shelby said he wasn't voting for Moore because "Alabama deserves better," but the political shop - which had not been checking in with him - received no advance warning.
In two tweets Tuesday night, Tony Fabrizio, a pollster on Trump's campaign, wrote that the president "needs to get better political advisers."
"This disaster could have been avoided," Fabrizio wrote, adding that "there does need to be a recognition of the lousy political advice @POTUS has been getting and it needs to change. The future of @POTUS agenda depends on it!"
The West Wing found itself divided as the Alabama Senate race finally reached its unexpected conclusion Tuesday night. Though some in the West Wing faulted McConnell for too aggressively trying to push Moore from the race, others - including the president - were angry with Bannon, who had pushed Trump to support Moore on the promise that he could win.
Rep. Peter King, R-N.Y., said he'd gotten lots of feedback from White House aides after saying Bannon "looks like some disheveled drunk who wandered on to the political stage."
"They say, keep it up, let him have it," King said.
Andy Surabian, a political operative in Bannon's orbit, argued that Bannon had never been a huge fan of Moore but was simply determined to use the race to make McConnell a potential albatross in Republican primaries. People close to Trump said they expect his anger at his former chief strategist will subside, and the president is likely to continue speaking with him.
"Team Mitch successfully delivered this race to a liberal Democrat and so they won the battle, but in the end, we will win the war," Surabian said.
Vice President Mike Pence had initially encouraged Trump to support Strange in the party's primary, but he stayed away from the race after Strange lost. One person who spoke with the vice president said he was glad to steer clear of the Senate contest, especially after the allegations against Moore of sexual mishevavior emerged; another person close to Pence said he didn't see much strategic gain to be had in getting involved.
The Republican National Committee and the White House also found themselves at odds. Though the committee had withdrawn its support for Moore after the accusations emerged, initially with the blessing of the White House, chairwoman Ronna McDaniel was given virtually no notice before Trump endorsed Moore.
She was especially distressed at the process, when the White House forced the RNC back into the race, but accepted their prerogative to do so. She told Trump that she didn't think that there was any reason for him to get back involved with Moore - and that the decision could hurt him.
But on Wednesday, at least, Trump seemed like a man who had accepted the results and was prepared to move forward.
"Wish we would have gotten the seat," Trump said during a brief appearance before reporters at the White House. " A lot of Republicans feel differently, they're happy very with the way it turned out."
"But," he concluded, "I would have, as the leader of the party, I would have liked to have had the seat."