Republican Senator John McCain, only recently diagnosed with brain cancer, cast the deciding vote against the legislation.

U.S. Republicans failed spectacularly on Friday in their latest effort to dismantle Obamacare, leaving the party in stunned disarray and President Donald Trump's dreams of repealing his predecessor's health reforms on ice.

The extraordinarily tense vote — held in the dead of night — came down to the wire, with Republican Senator John McCain, only recently diagnosed with brain cancer, casting the deciding vote against the legislation.

“This was a disappointment, a disappointment indeed,” Senate Majority Leader Mitch McConnell told colleagues after the vote.

Trump says 'let Obamacare implode'

US President Donald Trump urged Republican congressional leaders to let Obamacare "implode" rather than immediately work to fix it, after the Senate rejected a bill that would repeal the health care law.

"3 Republicans and 48 Democrats let the American people down," Mr. Trump tweeted, referring to the 49-51 vote in the dead of night on a controversial plan that would have partialliy dismantled the Affordable Care Act.

"As I said from the beginning, let ObamaCare implode, then deal," the president said.