Early Friday morning, Sen. John McCain walked into the Senate chamber and, to a burst of applause from Senate Democrats, cast the decisive vote to defeat Majority Leader Mitch McConnell's Health Care Freedom Act. It was a historic moment. And I have never been happier to have been dead wrong.

Earlier this week, McCain — who was recently diagnosed with brain cancer — flew to Washington, D.C., to vote on the motion to proceed with health-care legislation. He gave an intense speech harshly (and accurately) condemning the incredibly opaque and undemocratic process that McConnell was trying to use to ram an extremely unpopular bill through the Senate. The only problem was that he had just cast a crucial vote to allow the process he was attacking to go forward.

Some journalists praised McCain's speech nonetheless. Other journalists and pundits roundly mocked McCain for harshly condemning a process he cast a decisive vote to continue. I will freely admit that I was one of the skeptics. McCain had a history of showing rhetorical independence from the Republican leadership and then voting the party line. I thought we were seeing this again, at the worst possible time.

But, for once, the conventional wisdom was right. McCain told Minority Leader Chuck Schumer at 10 p.m. Thursday night. Some reporters on the floor began to get the impression that the bill might be in trouble. And, ultimately, McCain voted to kill the bill. The "maverick" earned his reputation with the highest stakes imaginable, and I'm happy to eat crow. We don't know yet why he did it, but his actions are what matter.

This is, above all, a victory for the American public. The so-called "skinny repeal" bill that was killed this morning would have led to 16 million people losing their health insurance and caused premiums to skyrocket. It would have resulted in millions of people losing employer-provided coverage and destroyed the individual insurance markets in many states. It would have savagely cut funding for women's health services and public health funding. Sen. Lindsey Graham (R-S.C.) called it a "disaster" — so you can imagine what people who didn't vote for it thought.

And a bill modified by a conference committee if this bill had passed would have almost certainly been even worse. It probably would have restored some or all of the draconian Medicaid cuts in the House and Senate bills, and eliminated even more of the Affordable Care Act's crucial consumer-protection regulations.

So the most important recent expansion of the American welfare state has been preserved. It's almost impossible to overstate the magnitude of this policy victory. Hundreds of thousands of lives have been saved. A great deal of suffering and countless medical bankruptcies have been averted. Dedicated protesters were celebrating outside of Congress, and they were right to.

This bill will also have a substantial political fallout. Oddly, McConnell did not release any further marginal votes even after he lost his majority. McCain and Sens. Susan Collins (Maine) and Lisa Murkowski (Alaska) — the latter two of whom voted no on the motion to proceed earlier in the week — were the only Republicans to vote "no." The two most vulnerable Senate Republicans in 2018, Jeff Flake of Arizona and Dean Heller of Nevada, cast futile "yea" votes. As Pema Levy of Mother Jones observed: "The best outcome for Dems tonight was for bill to fail, while top targets Heller and Flake vote aye. Amazingly, that's what happened." And numerous House Republicans who face tough re-election fights in 2018 also voted for an incredibly unpopular bill without getting anything in return.

This doesn't mean that Democrats will take over Congress in 2018. The Senate map is brutal for the Democrats, who may not be able to win the three seats they need to take over even in a wave election. The heavily gerrymandered House will also be a tough fight, although a winnable one.

But Democrats can worry about 2018 later. This was a major victory. Collins, McCain, and Murkowski deserve a lot of credit for bucking their party and doing what's right for the country. Deserving even more credit is every member of the Democratic caucus in the House and Senate, all of whom were steadfastly opposed to every terrible Republican proposal. And the most credit goes to the many citizens who gave so much. Supporters of the ACA took to the streets, called, and wrote, and made the public aware of what a fiasco passing this bill would have been. McConnell's failure is above all a triumph of democracy over a party whose leadership expressed stunning contempt for democratic norms.

Bless you, John McCain, for recognizing it.