President Donald Trump prepared for the pivotal meeting with congressional leaders by huddling with his senior team - his chief of staff, his legislative director and the heads of Treasury and the Office of Management and Budget - to game out various scenarios on how to fund the government, raise the debt ceiling and provide Hurricane Harvey relief.
But one option they never considered was the that one the president ultimately chose: cutting a deal with Democratic lawmakers, to the shock and ire of his own party.
In agreeing to tie Harvey aid to a three-month extension of the debt ceiling and government funding, Trump burned the people who are ostensibly his allies. The president was an unpredictable - and, some would say, untrustworthy - negotiating partner with not only congressional Republicans but also with his Cabinet members and top aides. Trump saw a deal that he thought was good for him - and he seized it.
The move should come as no surprise to students of Trump's long history of broken alliances and agreements. In business, his personal life, his campaign and now his presidency, Trump has sprung surprises on his allies with gusto. His dealings are frequently defined by freewheeling spontaneity, impulsive decisions and a desire to keep everyone guessing - especially those who assume they can control him.
He also repeatedly demonstrates that, while he demands absolute loyalty from others, he is ultimately loyal to no one but himself.
"It makes all of their normalizing and 'Trumpsplaining' look silly and hollow," said Rick Wilson, a Republican strategist sharply critical of Trump, referring to his party's congressional leaders. "Trump betrays everyone: wives, business associates, contractors, bankers and now, the leaders of the House and Senate in his own party. They can't explain this away as [a] 15-dimensional Trump chess game. It's a dishonest person behaving according to his long-established pattern."
But what many Republicans saw as betrayal was, in the view of some Trump advisers, an exciting return to his campaign promise of being a populist dealmaker able to cut through the mores of Washington to get things done.
In that Wednesday morning Oval Office meeting, Trump was impressed with the energy and vigor of Senate Minority Leader Charles Schumerm D-N.Y., and House Minority Leader Nancy Pelosi, D-Calif., relative to the more subdued Senate Majority Leader Mitch McConnell, R-Ky., and House Speaker Paul Ryan, R-Wis. Far from fretting over the prospect of alienating McConnell and Ryan or members of his administration, he relished the opportunity for a bipartisan agreement and the praise he anticipated it would bring, according to people close to the president.
On Thursday morning, he called Pelosi and Schumer to crow about coverage of the deal - "The press has been incredible," he told Pelosi, according to someone familiar with the call - and point out that it had been especially positive for the Democratic leaders.
At the White House later that day, Trump asked Rep. Peter King, R-N.Y., how he thought the deal was playing. "I told him I thought it was great, and a gateway project to show there could be bipartisan progress," King said. "He doesn't want to be in an ideological straitjacket."
In some ways, White House officials said, Trump is as comfortable working with Democrats to achieve policy goals - complete with the sheen of bipartisan luster - as he is with Republicans. Though he did not partner with Democrats to spite McConnell and Ryan, aides said, he has long felt frustrated with them for what he perceives as their inability to help shepherd his agenda through Congress, most notably their stalled efforts to undo former president Barack Obama's signature health-care law.
On Thursday, Trump took to Twitter to express dissatisfaction with his adopted political party, complaining about Obamacare: "Republicans, sorry, but I've been hearing about Repeal & Replace for 7 years, didn't happen!" He also bemoaned the legislative filibuster, which requires Republicans to work with Democrats to meet a 60-senator threshold for most votes, writing, "It is a Repub Death wish."
Ari Fleischer, press secretary under President George W. Bush, said that Trump deserves credit for staving off, at least in the short term, a possible default and government shutdown.
"It's going to internally hurt him that he didn't work with Republicans on this one, but by avoiding a mess, he likely saved Republicans from themselves," Fleischer said. "I consider it a small victory that congressional Republicans didn't once again trip themselves up over this issue. At least for now."
King, a moderate who represents a Long Island district that Trump carried, said: "I think this could be a new day for the Republican Party."
Trump's agreement with the Democrats is hardly the first time the president has flouted his allies, including those around the world, sending them skittering nervously in response to a threat or a sudden turnabout.
In April, Trump thrust Canada and Mexico - as well as many of his advisers and Cabinet officials - into a state of panic during a frenetic, if brief, period when he threatened to withdraw from the North American Free Trade Agreement. In May, speaking in front of NATO's sparkling new headquarters, Trump alarmed European allies when he chastised them for "not paying what they should be paying" and refused to embrace the treaty's cornerstone - that an attack on one represents an attack on all. And in September, as the crisis with North Korea escalated, Trump abruptly threatened to withdraw from a free-trade agreement with South Korea.
Foreign diplomats euphemistically describe the president as "unpredictable," and even those with good relationships with the United States say they are "cautiously optimistic" that Trump's behavior will continue to benefit their nations.
On the issue of the debt-ceiling extension and short-term government funding, a GOP aide familiar with Wednesday's meeting said many Republicans viewed Trump's decision as "a spur-of-the-moment thing" that happened because the president "just wanted a deal."
"He saw a deal and wanted the deal, and it just happened to be completely against what we were pushing for," said the aide, who spoke on the condition of anonymity to offer a candid assessment. "Our conclusion is there isn't much to read into other than he made that decision on the spot, and that's what he does because he's Trump, and he made an impulsive decision because he saw a deal he wanted."
From the outset, the meeting did not go as Republican leaders and Treasury Secretary Steven Mnuchin had hoped. They began by pushing for an 18-month extension of the debt ceiling, with Mnuchin lecturing the group of longtime legislators about the importance of raising the debt ceiling, according to three people familiar with the gathering who spoke on the condition of anonymity.
"It was just odd and weird," one said. "He was very much a duck out of water."
The treasury secretary presented himself as a Wall Street insider, arguing that the stability of the markets required an 18-month extension.
At one point, Schumer intervened with a skeptical question: "So the markets dictate one month past the 2018 election?" he asked, rhetorically, according to someone with knowledge of his comment. "I doubt that."
At another, Pelosi explained that understanding Wall Street is not the same as operating in Congress. "Here the currency of the realm is the vote," she told reporters in a news conference Thursday, echoing the comments she had made privately the day before. "You have the votes, no discussion necessary. You don't have the votes, three months."
The Republican leaders and Mnuchin slowly began moderating their demands, moving from their initial pitch down to 12 months and then six months. At one point, when Mnuchin was in the middle of yet another explanation, the president cut him off, making it clear that he disagreed.
The deal would be for three months tied to Harvey funding, Trump said - just as the Democrats had wanted.
On Friday morning, at a closed-door meeting of House Republicans, numerous lawmakers vented their frustrations to Mnuchin and White House budget director Mick Mulvaney. One of them, Rep. Lee Zeldin, R-N.Y., stood up to say he thought Trump's snub of Ryan – who had publicly rejected Democrats' offer hours before Trump accepted it - was also a snub of Republicans at large.
"I support the president, I want him to be successful, I want our country to be successful," Zeldin said in an interview afterward. "But I personally believe the president had more leverage than he may have realized. He had more Democratic votes than he realized, and could have and would have certainly gotten a better deal."
Democrats remain skeptical about just how long their newfound working relationship with Trump will last. But for Republicans, the turnabout was yet another reminder of what many of them have long known but refused to openly admit: Trump is a fickle ally and partner, liable to turn on them much in the same way he has turned on his business associates and foreign allies.
"Looking to the long term, trust and reliability have been essential ingredients in productive relationships between the president and Congress," said Phil Schiliro, who served as director of legislative affairs under Obama. "Without them, trying to move a legislative agenda is like juggling on quicksand. It usually doesn't end well."
The Washington Post's Mike DeBonis contributed to this report.