At about 1:40 on Friday morning, Mitch McConnell, the Senate Majority Leader, stood behind a lectern in the U.S. Senate, his left hand in his pocket, and said, “So, Mr. President, this is clearly a disappointing moment.” A few minutes earlier, the Senate had narrowly voted down a so-called skinny-repeal bill, which was McConnell’s latest ploy to keep alive the Republican Party’s seven-and-a-half-year effort to dismantle the Affordable Care Act. The bill would have eliminated some parts of Obamacare, including the individual mandate. Perhaps more importantly, its passage would have tossed the ball to a House-Senate conference committee, where a more comprehensive demolition plan could have been worked up.

The historic vote was fifty-one to forty-nine against the bill, with three Republican senators joining the Democrats in opposing it. Two of the G.O.P. dissidents were Maine’s Susan Collins and Alaska’s Lisa Murkowski. Both of them had bravely resisted their party’s previous efforts to pass damaging health-care bills. The other Republican no vote was cast by the cancer-stricken John McCain, of Arizona, who, in an astonishing piece of political drama, helped deliver a monumental blow to his party’s leadership and to President Trump, who once mocked and grievously insulted him.

Shortly before the vote was taken, C-SPAN’s cameras showed McCain engaged in warm conversations with a group of Democrats. He also had some seemingly frostier exchanges with some of his Republican colleagues. At one point, McConnell walked by McCain and the two men appeared to ignore each other. Shortly before the vote, Vice-President Mike Pence—who was in the room to break a tie in case of a fifty-fifty vote—left the chamber. When the roll-call vote was taken and McCain’s name was called out, he gave a thumbs-down sign and said, “No.” Democrats cheered and applauded.

Skinny repeal had been McConnell’s fallback strategy: during the previous couple of weeks, the Senate had already rejected a bill that would have replaced Obamacare and another that would have repealed it without providing any replacement. On Friday morning, the Senate Majority Leader acknowledged that the jig was up. Referring to Democratic efforts to stymie the Republican repeal push, he said, “I regret to say they have succeeded in that effort. So, now I think it is appropriate to ask: What are their ideas? It will be interesting to see what they suggest as the way forward.”

McConnell posed the question more out of pique than because the spirit of coöperation had overcome him. But the fact is, he and other Republicans now have little choice but to engage in some sort of negotiation process with the Democrats. The G.O.P.’s signature policy initiative has collapsed under the weight of its own shortcomings and contradictions.

As McConnell indicated, the Senate Democrats, who stayed united under their leader, Chuck Schumer, deserve some of the credit for instigating this collapse. So do all the activists, protesters, and policy wonks who have spent much of the past six months working to frustrate the Republicans’ heartless and ill-considered designs. Also deserving credit are ordinary Americans, who, as the details of the various Republican proposals became clear, decided in very large numbers that they would be better off sticking with Obamacare, for all its problems.

But above all else, the collapse reflects a failure of the Republican Party and its President. Trump’s rise to power has undermined his party’s internal cohesion. And his ignorance of basic health-care-policy details hampered efforts to win over public support for the repeal effort. The G.O.P. is now a conservative political organization that favors small government and abhors the expansion of the welfare state, yet it has come to rely on the votes of less affluent white voters, many of whom depend on government programs—particularly Medicaid—that would have been slashed under the Party’s repeal plans.

As long as repealing Obamacare was merely a slogan used to rally disaffected voters, the G.O.P. leadership could afford to ignore this tension. But after a President from their own party was unexpectedly voted into the White House, Republicans were forced to put an actual policy proposal on the table. In the end, the tension was too difficult to resolve, even for McConnell, who employed secrecy, subterfuge, and clock-management to try to railroad any bill he could though the Senate. His office didn’t even publish the skinny-repeal bill until 10 P.M. on Thursday, just two hours before the vote was scheduled to take place.

As the senators prepared to cast their votes, most observers assumed that the bill would pass. With just forty-eight votes of their own, the Democrats didn’t have the numbers to stop it. Still, some of them did get the chance to state a few truths. “This is nuclear-grade bonkers, what is going on here tonight,” Chris Murphy, of Connecticut, said during the brief debate. “We are about to reorder one fifth of the American health-care system, and we are going to have two hours to review a bill … that is lighting the American health-care system on fire with intentionality.” “Why is this being run this way?” Schumer asked. "Why is this being done in the dead of night. I can’t believe that my”—Republican—“colleagues are proud of this.” Cory Booker, of New Jersey, said, “This is not what the people want. This is a betrayal of our values. This is a betrayal of our history.”

The Republicans, for their part, appeared barely more enthusiastic about the contents of the bill, which the Party leadership openly presented as a ruse. “We intend to pass a bill and to conference with the House to make the bill better,” John Cornyn, the Majority Whip, said in closing the debate. According to an instant analysis from the Congressional Budget Office, the bill would have increased the number of uninsured by fifteen million over ten years and raised premiums by twenty per cent. “It is not perfect but it is better than the status quo,” Cornyn added.

Earlier in the day, some of Cornyn’s colleagues were highly critical of the proposal they were being asked to support. Four of them—McCain; Lindsey Graham, of South Carolina; Bill Cassidy, of Louisiana; and Ron Johnson, of Wisconsin—held a press conference at which they threatened to vote against the bill unless they received firm assurances that it wouldn’t become law. (Although this press conference took place before McConnell’s office published the bill, the major elements it would contain were already known.) “The skinny bill as policy is a disaster,” Graham said. “It is not a replacement in and of itself.”

A few hours later, Paul Ryan, the Speaker of the House, issued a statement in which he confirmed that he was willing to set up a House-Senate conference committee to hash out a broader bill, which would then be sent back to the Senate. This satisfied three of the Republican doubters, who indicated that they would support McConnell’s measure. Shortly before 9 P.M., however, McCain said that Ryan’s statement was “not sufficient,” thus raising the possibility that he would join with Collins and Murkowski to defeat the bill.

On Tuesday, McCain had returned to the Senate for the first time since being diagnosed with brain cancer, and he’d delivered a speech upbraiding his colleagues for acting out of partisanship. He called for a return to “regular order” and for coöperation with the other party. Yet despite the laudable rhetoric of this speech, McCain voted for a procedural motion that allowed McConnell to bring various Obamacare-repeal measures to a vote. Later in the week, he also voted for McConnell’s repeal-and-replace bill, which was drawn up in secrecy with very little consultation.

On Thursday, even after McCain said that he wasn’t satisfied with Ryan’s assurances, many observers assumed it was another head fake—that he would ultimately align himself with his party’s leadership. As he made his way toward the Senate chamber, a reporter asked him which way he would cast his vote. “Wait for the show,” he replied. It turned out to be worth waiting up for.

“I thought it was the right thing to do,” he told reporters as he left after the vote. A bit later, in a statement, he said, “We must now return to the correct way of legislating and send the bill back to committee, hold hearings, receive input from both sides of the aisle, heed the recommendations of the nation’s governors, and produce a bill that finally delivers affordable health care for the American people.”

To be sure, McCain’s statement didn’t address the many complexities of achieving the goal that he laid out. But it was his vote that mattered, not his words. Together with the votes cast by Collins and Murkowski—not to mention every Democrat in the Senate—it has hopefully killed the Republican Party’s misguided effort to destroy the A.C.A. and turn back history.