US Senate Republicans have failed to overturn the healthcare law known as Obamacare, effectively ending the Republican Party's seven-year quest to repeal the 2010 Affordable Care Act.

Three Republicans crossed party lines on Friday and joined Democrats to kill the bill.

It was voted down 51 votes to 49 late in the night.

Senator John McCain, who returned to the Senate this week after receiving a diagnosis of brain cancer, cast the decisive vote to defeat the measure.

The bill, dubbed the "skinny repeal", was the last resort for Senate Republicans to pass something - anything - to trigger negotiations with the House on a broader repeal-and-replace plan.

READ MORE: Trump's effort to replace Obamacare in disarray

"This is clearly a disappointing moment," Senate Majority Leader Mitch McConnell said on the floor after the vote.

The collapse marks a major setback for US President Donald Trump, who had campaigned relentlessly on a pledge to repeal and replace the law passed under his predecessor Barack Obama.

In a Twitter post, Trump said the three Republicans and Democrats "let the American people down".

Charles Schumer, the Senate minority leader, said it was time "to turn the page".

"We are not celebrating. We are relieved," he said.

Friday's vote was on a bill that would have rolled back only parts of Obamacare but kept the bulk of the law intact.

It would have overturned a provision requiring most people get health insurance or risk a fine, delayed a tax on medical devices, and denied funding to Planned Parenthood for a year.

The nonpartisan Congressional Budget Office estimated that if it became law, 15 million fewer Americans would be insured in 2018 than under existing law.

Senate Republicans decided to vote on the pared-down proposal after a comprehensive bill failed on the Senate floor, and a straight-up repeal failed as well.