Jonathan Ernst / Reuters

Like a figure in a classic Western—whether he’s a hero or villain depends on your political views—Donald Trump keeps being left for dead in the desert, and he keeps sauntering into the town saloon with a smirk on his face, to gasps all around.

Tuesday afternoon, the Senate voted to proceed on debate on the latest attempt to repeal Obamacare. It is an early, incremental, and partial victory for the president, but it is a victory nonetheless. And it is the second time that a bill has appeared dead in one of the chambers of Congress, only to be resuscitated—in part by Trump’s refusal to let legislators move on.

The ultimate fate of the health-care effort remains murky. The Senate voted to open debate, but then failed to approve a broad repeal Tuesday night, leaving it unclear what bill if any the Senate might pass, or what might happen in conference committee with the House.

“I want to congratulate American people because we're going to give you great health care,” Trump said Tuesday afternoon in the Rose Garden , where he was holding a brief press conference with visiting Lebanese Prime Minister Saad Hariri. “And we're going to get rid of Obamacare which should have been, frankly, terminated long ago. It's been a disaster for the American people.”

The celebration was more subdued than after the House passed its repeal bill in May, which Trump marked with a Rose Garden bash with congressional leaders. But it was still an important win. Barely 24 hours earlier, the Senate seemed incapable of even opening debate, much less passing any bill. That was certainly the case last week, when a distracted Trump suddenly realized that the Senate didn’t have the votes and began taking action.

Senate Majority Leader Mitch McConnell deserves a greater share of the credit than Trump, but the president upped his involvement. He invited senators to the White House to discuss health care, where he shamed them for not getting things done. “I don’t think we should leave town unless we have a health-insurance plan,” he said. He also had a veiled threat for Nevada Senator Dean Heller, who had been a holdout on the bill and was seated to Trump’s right. “Look, he wants to remain a senator, doesn't he? ​​​​​​” Trump quipped.

During his bizarre appearance at the annual Boy Scout Jamboree in West Virginia, he publicly bullied both Health and Human Services Secretary Tom Price and Mountain State Senator Shelley Moore Capito, another holdout. “You going to get the votes?” Trump asked Price. “He better get them. He better get them. Oh, he better—otherwise, I’ll say, Tom, you're fired. I’ll get somebody. He better get Senator Capito to vote for it.” As the coup de grace, Trump got the clinching vote from John McCain, the GOP elder statesman he’d derided during the campaign, who flew in just days after surgery and a brain-tumor diagnosis.

But Trump’s most important role was simply his refusal to let the bill die. Republican legislators have recognized the dilemma that faces them: It’s very hard to find any bill that can pass both houses of Congress, satisfying both the conservative and centrist wings of the party, and any bill that does will fall well short of the promises that Republicans—most especially Trump—have made. There’s simply no solution that will reduce premiums, expand or maintain coverage, cut costs, and stabilize the insurance system while eliminating the individual mandate, insurance regulations, and Medicaid expansion. But after the House bill failed, and Trump took heat for it, he insisted that the House take it back up. Then he did the same again when the Senate bill looked dead.

Trump still seems to have little understanding of how the health-insurance system works. During a recent New York Times interview, he delivered an inscrutable riff about insurance costs that bore no resemblance to the actual system. During his lunch with senators, he once again promised to drastically reduce premiums, something that no GOP proposal actually does. And the struggles of the House and Senate bills are partly his fault, since he has declined to set any real (or realistic) parameters for a bill and has largely stayed out of the arm-twisting process until things are falling apart, in both cases.

The Obamacare repeal process in the Senate and in conference remains in a fragile state, and Trump could always change his mind and torpedo the process later. Having thrown the big bash to celebrate the House bill, he later turned around and called it “mean.” Having demanded that Republicans both repeal and replace Obamacare at the same time, he then complained that they should have sought to repeal first and deal with replacement later, then reverted back to his initial view. Any bill that emerges will be politically toxic and strip millions of insurance. For the time being, however, Trump has managed to rescue a bill everyone else believed to be dead.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.