In a dramatic last-minute spectacle, the latest Republican plan to destroy the Affordable Care Act was defeated early Friday because of the courageous votes of three senators: Susan Collins, John McCain and Lisa Murkowski. This will come as an immense relief to millions of Americans who stood to lose their health insurance, but it would be naïve to think that this is the end of the road for the repeal-Obamacare movement.

For the last seven years, Republican leaders have engaged in a fraudulent campaign against the A.C.A. based on the lie that the law is either unworkable or collapsing. The law, which is based on conservative market-based ideas, is certainly flawed and could be improved, but it has helped 20 million people gain insurance and, as a result, provided needed medical care to the poor and the sick. Not only was the Republican diagnosis wrong, but also leaders like the House speaker, Paul Ryan, and the Senate majority leader, Mitch McConnell, tried to push through legislation that was devoid of any ideas and would have weakened the health care system and left millions unable to afford health care. One telling sign: Insurance companies, hospitals, doctors and public interest groups like AARP opposed pretty much every proposal the Republicans put out over the last seven months.

Ultimately, this deceitful campaign ran aground by the narrowest of margins in the Senate thanks to the three Republicans and all 48 Democrats and independents. Much attention has rightly focused on Mr. McCain. Returning to the Senate after surgery and a brain cancer diagnosis, he delivered a stirring speech on Tuesday calling on lawmakers from both parties to reach “agreements made in good faith that help improve lives and protect the American people.” He seemed to go against those sentiments early in the process when he voted to start debate. But, when it really counted, Mr. McCain did the right thing. An equal or larger amount of credit ought to go to Ms. Collins and Ms. Murkowski, who stood firm despite immense political pressure and, in Ms. Murkowski’s case, shameful threats by the Trump administration.