It started out cold as ice, and then turned warm and friendly. Now the tortured relationship between President Donald Trump and House Speaker Paul Ryan has gone cool again, with the Republican president making clear he has no qualms about bucking the GOP leader to cut deals with his Democratic foes.

The two men dined at the White House Thursday night and discussed legislative challenges ahead for the fall, a get-together that was scheduled over Congress’ August recess, long before the head-spinning events of this week. In a moment that stunned Washington, Trump cut a debt and disaster aid deal Wednesday with Congress’ Democratic leaders as Ryan and Senate Majority Leader Mitch McConnell watched on helplessly, after lobbying unsuccessfully for much different terms.

The moment distilled the inherent tensions between Trump, 71, a former Democrat and ideologically flexible deal-maker, and Ryan, 47, a loyal Republican whose discomfort with Trump led him to withhold his endorsement for weeks last year.

After Trump was elected the two papered over their differences and even developed a rapport, talking frequently during health care negotiations earlier this year, as each understood they needed the other to advance individual and shared goals. But their phone calls have tapered off of late and Trump has expressed his frustration with GOP leaders on multiple fronts, culminating in the president’s decision to ditch them and join hands with the Democrats instead.

Trump exulted in his newly bipartisan approach Thursday, declaring it “a great thing for our country,” while Ryan mostly grinned and bore it.

At the Capitol on Wednesday, Ryan had deemed a three-month debt ceiling increase as “unworkable” and “ridiculous.” Yet an hour later, Trump overruled his strong objections to side with the Democrats.

The president’s rebuff on the debt came just days after Trump ignored Ryan’s pleas not to end the program to aid immigrants brought to the country as children and living here illegally. Instead, Trump ended the program and tossed the issue to Congress to resolve in six months.

The debt deal headed for House passage Friday along with $15 billion in disaster aid and a three-month government funding extension.

Indeed for Ryan, GOP reactions to the deal exposed some lurking threats to his perch atop a conference where unrest brews nearly ceaselessly among conservatives, and there have been recent rumblings of a possible coup.

Trump remains highly popular in the conservative districts occupied by many House Republicans, much more so than Ryan himself, who is scorned by many in the GOP base as an establishment sell-out. In a whipsawed moment, some House Republicans defended Trump’s handling of a deal they don’t like, while simultaneously criticizing Ryan, who had been overruled by the president. It also underscored the political pressure on Ryan to try to remain in the president’s good graces even when Trump is flirting with Democrats.

Rep. Steve King, R-Iowa, said the message in his conservative district is that “congressional Republicans need to get behind the president.”

That sentiment “makes him weaker,” King said of Ryan.

Rep. Paul Gosar of Arizona described Ryan as “very unpopular” in his district, while regard for Trump is “pretty high.”

As far as his constituents are concerned, Gosar said, they’d be happy if Ryan got the boot and Trump stayed. “That’s kind of the mantra in my district,” he said.

For his part, Trump has soured on the Republican congressional leadership in recent months, fuming to associates that they led him astray on their health care strategy, among other complaints.

The president has told those close to him that he regrets choosing to tackle the repeal and replace of Barack Obama‘s health care law as his first legislative push. He has singled out Ryan for blame, saying the speaker assured him it would pass and instead handed him an early, humiliating failure, before ultimate House passage of a revived bill, according to three White House and outside advisers familiar with the conversations but not authorized to speak about them publicly.

GOP health care efforts collapsed in the Senate in July.

Trump has spoken to Ryan less frequently in recent weeks, particularly after the departure of his first chief of staff, Reince Priebus, who has deep Wisconsin ties to the speaker. Priebus would sometimes broker the calls and stress to each man their importance, according to two people familiar with the conversations. Those calls have occurred less often since John Kelly took over as chief of staff.

Though Trump has expressed particular anger at McConnell for the failed Senate health care vote and for not protecting him from the Russia investigation, he grudgingly has told associates that he is aware of the Senate leader’s grip on power. He has spoken less glowingly about Ryan’s own ability to lead due to the shorter House terms and the growing insurgency within the conservative Freedom Caucus.

Ryan’s position is seen as secure for now, if only because it is widely accepted that no other House Republican could garner the support needed to replace him. But even allies believe his tenure in the job could be finite, and might depend in part on the whims of a president with whom he has no real deep ties.

“I think any speaker is going to have a very difficult time in this environment,” said Rep. Tom Reed, R-N.Y. “The nature of that job, I think, over time, they don’t last.”

Like this:

THE LATEST FROM #ALPolitics

Alabama Today will be the first place Alabamians of influence go for an inside look at breaking statewide, political and business news.

Led by Apryl Marie Fogel, a political activist with over a decade of experience, the Alabama Today team includes freelance news reporters, as well as guest columnists from around the state.

According to Fogel: "My biggest goal for Alabama Today is to provide up to the minute information that will influence the direction of our state. Alabama Today is a platform unlike any other in the state, where news is news and opinion is opinion. I'm excited to focus on two subject areas that I am passionate and dedicated to -- political news and opinions and recognizing and growing influential women."

Alabama Today is also the host of Context Alabama where voices of experience and influence statewide will regularly be published. Featuring Alabama's leading political consultants, grassroots leaders and influencers Context Alabama will provide commentary on the hottest topics.