Three Republican senators defeated their party's eleventh-hour plan early Friday morning to repeal Obamacare: John McCain, Lisa Murkowski and Susan Collins.

Around 1:30 a.m. ET, the so-called "skinny repeal" plan devised by Senate Republican leaders and whose text was released only three hours earlier, was rejected in a dramatic 49-51 vote.

For weeks, Collins, who represents Maine, and Murkowski, who represents Alaska, had been opposed to, or were skeptical about, a number of proposals throughout the process, which culminated with a series of votes that began earlier this week when senators voted to open debate on the House-passed health care measure, the American Health Care Act (AHCA).

Get Breaking News Delivered to Your Inbox

Sen. Susan Collins, R-Maine

Since the upper chamber first took up health care this year in late June, Collins had opposed the original repeal and replace plan, known as the Better Care Reconciliation Act (BCRA), as well as the amended version that failed in a vote on Tuesday of this week. She also rejected legislation Wednesday that resembled a bill she also voted against in 2015 that would have repealed Obamacare, but would have delayed it from taking effect for two years so Republicans could come up with a replacement plan. On Tuesday, she even voted against a motion to proceed to open debate on the bill as she had been pushing for bipartisan negotiations and to start over at the committee level.

In a statement after the final vote early Friday, Collins said that while she supported components of the final plan and that many Americans are suffering under Obamacare, she said Republican leaders punted on many difficult questions.

"We need to reconsider our approach," she said. "The ACA is flawed and in portions of the country is near collapse. Rather than engaging in partisan exercises, Republicans and Democrats should work together to address these very serious problems."

Sen. Lisa Murkowski, R-Alaska

Murkowski, meanwhile, had been concerned from the beginning about the effect BCRA, the repeal and replace plan, would have on Alaska's Medicaid expansion under Obamacare. The repeal and replace plans that were considered would have rolled back the expansion and would have cut funding from the entitlement program. She voted with Collins and Democrats Tuesday against advancing to debate and the amendment process on health care. Interior Secretary Ryan Zinke delivered a warning to Murkowski about her vote, which was that her vote put Alaska's relationship with the Trump administration in jeopardy.

Another reason the two senators opposed the "skinny repeal" -- it would have eliminated funding for Planned Parenthood and similar providers, which both of them made clear they would oppose.

Sen. John McCain, R-Arizona

McCain's plan, however, to ultimately defeat the party's final attempt at a repeal this week was not expected. He was absent from Capitol Hill last week because of his brain cancer diagnosis. When he returned on Tuesday, most assumed he came back to rescue Republicans. On Tuesday, he voted to open debate and on the modified repeal and replace plan. On Wednesday, he was one of seven Republicans who voted against the 2015 repeal bill.

Then on Thursday evening, he and Sens. Lindsey Graham, R-South Carolina, Ron Johnson, R-Wisconsin, and Sen. Bill Cassidy, R-Louisiana, suddenly held a press conference announcing that they would not vote for the "skinny repeal" unless Speaker Paul Ryan, R-Wisconsin, assured them that it would not become law, and would only be the means to open up a conference committee with the House.

Behind the scenes, Senate Minority Leader Chuck Schumer, D-New York, had been lobbying McCain every day since he returned, several times a day, according to a source familiar with their conversations. Schumer knew in advance of the vote that McCain would defect, the source said.

McCain argued in a statement Friday that the bill would not lower costs, increase competition or improve care for Americans. And, he said, the statement issued by Speaker Ryan was not sufficient to ease his concerns about its becoming law.

"While the amendment would have repealed some of Obamacare's most burdensome regulations, it offered no replacement to actually reform our health care system and deliver affordable, quality health care to our citizens," 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 aisle, heed the recommendations of nation's governors, and produce a bill that finally delivers affordable health care for the American people."

None of the three senators is up for re-election next year.