WASHINGTON — All week long, Senate Democrats had quietly groused that Senator John McCain made a stirring return to the Senate after a brain cancer diagnosis, that he preached the virtues of bipartisanship — and that he then backed a Republican-only push to replace the Affordable Care Act.
But early Friday morning, Mr. McCain, showing little sign of his grave illness, strode onto the Senate floor as the vote was being taken to repeal it, and shocked many of his colleagues and the nation. He sought recognition from the vote counters, turned his thumb down, and said “no.” There were gasps and some applause.
He had just derailed the fevered Republican effort to undo the Obama-era health care law.
It was a stunning moment that will be long remembered in the Senate, a flash of the maverick John McCain, unafraid of going his own way despite the pleas of his fellow Republicans. In teaming up with Senators Susan Collins of Maine and Lisa Murkowski of Alaska, who had already opposed the bill, Mr. McCain made good on his earlier promise to help defeat the measure if it didn’t meet his personal test.
No amount of arm-twisting by his peers, Vice President Mike Pence or even President Trump could sway him from the decision that he had telegraphed to some Democrats and Republicans in the anxious buildup to the vote.
Ms. Collins said Mr. McCain told her that he felt compelled to “do the right thing.” It probably didn’t hurt that it was also a measure of cold revenge against Mr. Trump, a man who on the campaign trail in 2015 had mocked Mr. McCain’s ordeal as a prisoner of war in Vietnam. Mr. McCain made no mention of that, however, and instead used his time of maximum impact in the spotlight to say that the spectacular collapse of the health bill provided a chance for renewal, an opening to get the Senate out of its dysfunctional and partisan rut.
“The vote last night presents the Senate with an opportunity to start fresh,” Mr. McCain said in a statement on Friday. “I encourage my colleagues on both sides of the aisle to trust each other, stop the political gamesmanship, and put the health care needs of the American people first. We can do this.”
His decision to reject the measure represented a remarkable turnaround from Tuesday. Mr. McCain, 80, whose brain cancer had been diagnosed just days earlier, arrived in the Senate to provide the vote Republicans needed to open debate on their jumbled efforts to find a legislative path to repeal the health care bill they had railed against for seven years. Mr. Trump praised Mr. McCain’s courage in returning to the capital.
Leading up to the vote, Mr. McCain, not untypically, had confounded both critics and admirers. His speech Tuesday had the potential to go down as a Senate classic, a call to restore the work-across-the-aisle traditions of the past.
“We’ve been spinning our wheels on too many important issues,” Mr. McCain scolded his colleagues. “We’re getting nothing done, my friends, we’re getting nothing done.”
Mr. McCain’s vote that day left Senator Mitch McConnell, the majority leader, smiling as his sometime foe, sometime friend from Arizona helped rescue the Kentucky Republican’s reputation as a master strategist.
He provided the vote to move the Republican measure forward and seemed to work throughout the week with his constant ally, Senator Lindsey Graham, Republican of South Carolina, to explore ways to get the legislation out of the Senate and over to the House as Mr. McConnell so badly wanted.
A hastily scheduled Thursday evening news conference set off alarm bells among Democrats that Mr. McCain was going to back the last-ditch “skinny” repeal effort and sustain the drive to overturn the Affordable Care Act.
But he had also been working back channels with Senator Chuck Schumer of New York, the Democratic leader, about his intentions. A relieved Mr. Schumer praised Mr. McCain after the vote.
“John McCain is a hero and has courage and does the right thing,” Mr. Schumer told reporters. “He is a hero of mine.”
Mr. McConnell was no longer smiling.
“So yes, this is a disappointment,” the majority leader said in an emotional speech after the vote. “A disappointment indeed.”
Other Republicans, while crediting Mr. McCain with a flair for the dramatic, said it was Republican voters who would be left disappointed by Mr. McCain’s act.
“The losers tonight are the people who believed in the democratic process, believe that actually when candidates run and say, ‘I will fight to repeal Obamacare,’ that that actually means they will fight to repeal Obamacare,” said Senator Ted Cruz, the Texas Republican who has clashed with Mr. McCain in the past. Mr. McCain was re-elected last year after making the repeal and replacement of the health care law a central element of his campaign.
As a senator from a state with a large population of older Americans, Mr. McCain has long involved himself in health policy, although the fine points are far from his chief area of expertise, military affairs. In this health care fight, Mr. McCain’s resistance appeared to be driven partly by concerns raised by Gov. Doug Ducey of Arizona about the potential loss of coverage in the state.
After turning Washington upside down over the last few days, Mr. McCain planned to be in Arizona on Monday for what his office described as a “standard post-surgical regimen of targeted radiation and chemotherapy.” Mr. McCain intends to keep working but does not plan to be back on Capitol Hill before September.
The question now is whether Mr. McCain’s vote will produce the results he wants: a more bipartisan approach to making changes in the health law that both sides acknowledge are needed. Or will it simply produce a stalemate that leads to a failure of the current system and a chorus of “we told you so” from Republicans?
The president made clear his unhappiness and issued a warning of what would come, predicting the current system would implode.
But for now, it was Mr. McCain who had seized the moment and set the course of the Senate.