The latest attempt to repeal the Obama-era healthcare act has failed after a dramatic night in the US Senate.
At least three Republicans - John McCain, Susan Collins and Lisa Murkowski - voted against the bill, which needed a simple majority to pass.
President Donald Trump tweeted that the three had "let the American people down".
3 Republicans and 48 Democrats let the American people down. As I said from the beginning, let ObamaCare implode, then deal. Watch!
— Donald J. Trump (@realDonaldTrump) July 28, 2017
Three Republicans crossed party lines to join Democrats in a 49-to-51 vote to kill the bill.
The so-called "skinny" repeal, which would have scaled back some of the more controversial provisions, is the third attempt to repeal Obamacare.
It would have resulted in 16 million people losing their health insurance by 2026, with insurance premiums increasing by 20 percent, according to the Congressional Budget Office (CBO).
But it was voted down by 51 votes to 49 in the Republican-dominated Senate.
Senate Majority Leader Mitch McConnell, a Republican, described the result as a "disappointing moment".
Democrat Chuck Schumer said his party was relieved that millions of people would retain their healthcare.
The vote had been delayed after Senate Republicans kept a procedural vote open before the actual Obamacare vote while they attempted to persuade their members to vote for the repeal.
Vice President Mike Pence was seen talking to Mr McCain for more than 20 minutes.
But Mr McCain then approached a group of Democrats who appeared happy to see him.
After the vote, Mr McCain said that the skinny repeal did not amount to meaningful reform and would not have improved care for Americans.
He added that House Speaker Paul Ryan's assurance that the House would be willing to send the bill for further consideration by committee "did not ease my concern that this shell of a bill could be taken up and passed at any time".
But Mr McCain also criticised the way Obamacare had been passed by Democrats and called for senators to "return to the correct way of legislating" with input from both parties.
The Trump administration had also put pressure on Sen Murkowski, with President Trump tweeting on Wednesday that she had "let the Republicans, and our country, down".
Ahead of Thursday's late-night vote, Mr Trump had urged Republicans to "get there after waiting seven years" and "give America great healthcare".
The "skinny" repeal plan would have eliminated parts of Obamacare - the Affordable Care Act - including the individual mandate requiring all Americans to have health insurance coverage, as well as a tax on medical devices.
- BBC / Reuters