WASHINGTON — In a stunning setback, the Senate narrowly rejected the Republicans’ slimmed-down Obamacare repeal bill early Friday morning after an ailing Sen. John McCain — whose support allowed the debate to begin Tuesday — cast a surprise “no” vote.

The bill was defeated 51-49 at around 1:45 a.m. following a long delay for the vote, scheduled for around midnight, as several Republicans, including Vice President Mike Pence, tried to persuade McCain to change his vote.

“This is clearly a disappointing moment,” said Senate Majority Leader Mitch McConnell (R-Ky.).

For four straight elections, Republicans had promised to repeal Obamacare, McConnell said. “We told our constituents we would vote that way,” he said. “When the moment came — when the moment came — most of us did.”

President Donald Trump threatened to let the health care system collapse, tweeting, “3 Republicans and 48 Democrats let the American people down. As I said from the beginning, let ObamaCare implode, then deal. Watch!”

McCain joined Sen. Susan Collins (R-Maine) and Sen. Lisa Murkowski (R-Alaska) in voting “no” with the 48 members of the Democratic caucus, as Pence waited to cast what many thought would be the decisive vote with the defection of only two Republicans.

advertisement | advertise on newsday

Some Democrats let out a shout when McCain stood at the front of the chamber and turned his thumb down to vote against the bill.

But Senate Minority Leader Chuck Schumer (D-N.Y.) spoke of the people who would now not have to lose health care coverage. He said, “We are not celebrating, we are relieved.”

Calling for bipartisanship, Schumer urged McConnell and Republicans to return to the way the Senate used to work — with committee hearings and debate by both parties.

“So let’s turn the page and work together to improve our healthcare system, and let’s turn the page in another way,” Schumer said. “All of us were so inspired by the speech and the life of the Senator from Arizona, and he asked us to go back to regular order.”

Sharing the post-midnight vote on the partial repeal bill was a motion by Sen. Patty Murray (D-Wash.) to instead send the bill to the Senate’s health committee for three days. Her motion failed 48-52 on a party-line vote.

After the vote on his bill, McConnell asked for consent from his colleagues to start the debate on the defense authorization bill being marshaled by McCain, chairman of the Senate Armed Services Committee.

McCain had asked to finish the Senate floor consideration of the defense bill soon, so he could return to Arizona for treatment for the brain cancer diagnosed a week ago. But Sen. Rand Paul (R-Ky.) objected, putting off consideration of the defense bill until next week.

McCain said he voted against McConnell’s “skinny bill” — a narrow and partial repeal to win votes from conservatives and moderates — because it did not repeal and replace Obamacare with “a solution that increases competition, lowers costs and improves care.”

McCain added in his statement that “one of the major failures” of Obamacare was that Democrats passed it without a single Republican vote. “We should not make the mistakes of the past,” he said.

After the vote, McConnell withdrew the underlying bill — the House Republican version of the Obamacare repeal approved after many starts and stops — from the calendar, effectively suspending its consideration.

advertisement | advertise on newsday

The bill McConnell proposed was a partial repeal of Obamacare that would have left the Medicaid expansion untouched. It proposed ending insurance mandates and the medical device tax, boosting health savings accounts, giving states flexibility and shifting funds to health care centers.

McConnell offered the narrow bill to win votes of at least 50 of the 52 Republican senators, after nine of his members voted against his comprehensive repeal-and-replace measure on Tuesday and seven voted against a measure to repeal but delay replacement of Obamacare.

But that attempt nearly backfired when Sens. Lindsey Graham (R-S.C.) and Ron Johnson (R-Wis.) joined McCain in threatening to vote against the measure until they received assurances that the House would not simply pass it and send it to the White House for a signature.

House Speaker Paul Ryan (R-Wis.) sought to offer that assurance by saying the House would be willing to move forward in a conference committee if that would help advance the bill, but he didn’t explicitly rule out a vote on it.

“I would like to have the kind of assurances he didn’t provide,” McCain told reporters before the vote.

advertisement | advertise on newsday

The skinny bill drew sharp criticism from both Graham, who called it a policy “disaster,” and Schumer, who said it was a Trojan horse for a full repeal that would be crafted in a conference between the House and the Senate.

If passed, the skinny bill would result over the next decade in the loss of insurance by 15 million people and a 20 percent increase each year in health plan premiums, the nonpartisan Congressional Budget Office said Thursday night.