WASHINGTON — The night before Speaker Mike Johnson, R-La., defied the hard-right wing of his party and brought up a bill to send more than $60 billion in aid to Ukraine, he spent a mostly sleepless night in a luxury hotel suite overlooking the Potomac River, bracing for a mutiny that would end his speakership.

“He was in turmoil,” his wife, Kelly, recalled of that night last spring, in an interview last fall. “We assumed we were done. ... We thought we were going home.”

Johnson spent the night praying in the living room of their suite at the Pendry. In the morning, he told his wife he was going to do what he thought was right, regardless of the personal political cost. He would move ahead with legislation to continue funding Ukraine’s fight against Russian aggression, telling colleagues that he wanted to be on the right side of history.

Less than a year later, Johnson still has his job and has made a 180-degree conversion on Ukraine. His reversal reflects a broader Republican capitulation to the president even from some of Congress’ most vocal Russia hawks as Trump pursues warmer relations with Russian President Vladimir Putin, blames Ukraine for the conflict and labels its president — but not Putin — “a dictator.”

The new alignment was on display in the explosive Oval Office meeting Friday in which Trump berated Ukrainian President Volodymyr Zelenskyy, ultimately kicking him out of the White House in a dramatic rupture in relations. Johnson responded hours later.

“Thanks to President Trump — the days of America being taken advantage of and disrespected are OVER,” he wrote on social media, adding, “What we witnessed in the Oval Office today was an American President putting America first.”

It is a particularly striking turn for the speaker, who less than a year ago was so sold on the worthiness of Ukraine’s struggle against Russian aggression that he was willing to lose his job to ensure continued financial support for it, in what the president now says was a terrible deal for the U. S.

Back then, Johnson engaged in highly secretive talks with top Biden administration officials to figure out how to salvage the aid, going to previously unreported lengths to keep those talks under wraps. Now, he is siding with Trump as he blames those same officials for causing the war and botching the U.S. response.

This account of those secret talks and internal conversations is drawn from interviews conducted last fall with people familiar with them, most of whom recounted them on the condition of anonymity for a forthcoming book, “Mad House: How Donald Trump, MAGA Mean Girls, a Former Used Car Salesman, a Florida Nepo Baby, and a Man With Rats in His Walls Broke Congress.”

Johnson argues that his position has not changed a bit since last year, claiming that he was moving to shore up Ukraine’s standing so Trump could come in and end the war. But behind the scenes, he was making a much more sweeping case about the need for strong U.S. backing to thwart Putin’s march and keep peace in Europe.

In the days leading up to last year’s vote, he engaged in tense talks with Rep. Marjorie Taylor Greene, R-Ga., who was threatening to oust him from his job if he allowed the Ukraine aid bill to come up. In one such meeting, Greene warned Johnson that the classified intelligence he was relying on to justify sending the funds was exactly the kind of information that had led the U.S. to search for weapons of mass destruction in Iraq that turned out not to have existed. The level of distrust tested Johnson’s patience.

Sen. Mitch McConnell, R-Ky., then the minority leader, was concerned when Johnson, a third-term member of Congress he had never heard of, was chosen to lead the House. McConnell was staking his legacy on backing Ukraine’s fight against Russia, and he was urging the inexperienced speaker to simply put a bill on the floor and see if it had the votes to pass.

“It’s going to take quite a bit of time,” Johnson told McConnell. “You’re going to have to trust me on this.”

The problem was McConnell didn’t, really.

But what he did not know at the time was that Johnson was deep into talks with top Biden administration national security officials about how to make it work. He held secret conversations with Jake Sullivan, the national security adviser; Antony Blinken, the secretary of state; and Steve Ricchetti, President Joe Biden’s main conduit to Capitol Hill.

Paranoid that the hard right would discover their talks and tank them, Johnson’s staff tried to put nothing in writing and avoided meeting during work hours. These days, Johnson has been echoing a Russian talking point embraced by Trump.