United States President Donald Trump’s move to repeal Obamacare failed at the Senate on Friday, as Republican senators crossed party lines to join Democrats in a vote on the bill.

One Senator that posed a surprise in the voting was John McCain, whose return to Senate to take part in the vote was celebrated by president Trump.  

Repealing the bill was a major campaign promise of the Republicans, as they push to dismantle the Patient Protection and Affordable Care Act.

But that 7-year move got a stinging blow when 3 Republican senators, John McCain, Susan Collins and Lisa Murkowski, crossed party lines to join Democrats in a dramatic 49-to-51 vote to reject a "skinny repeal" bill.

"This is clearly a disappointing moment," Senate Republican leader, Mitch McConnell, said on an eerily quiet Senate floor right after the vote.

"The American people are going to regret that we couldn't find a better way forward," Reuters quoted him as saying.

The setback leaves Trump without a major legislative win after more than six months in power, despite Republicans controlling the White House, Senate and House.

It will also be a let-down for financial markets, which expected Trump to make rapid changes to healthcare, taxes and infrastructure spending.

"3 Republicans and 48 Democrats let the American people down. As I said from the beginning, let Obamacare implode, then deal. Watch!" Trump tweeted after the vote.

Trump has repeatedly berated congressional Republicans for being unable to overcome internal divisions to repeal Obamacare, but has offered no legislation himself, nor any clear guidance on what he would like to do about replacing the law.

The president has demanded at various times that Obamacare should be allowed to collapse on its own, that it should be repealed without replacement, and that it should be repealed and replaced.

The Affordable Care Act, approved by Democrats in 2010, is former Democratic President Barack Obama's signature domestic achievement. It provided health insurance to millions of previously uninsured Americans.

Republicans hold 52 seats in the 100-seat Senate. McConnell, whose reputation as a master legislative tactician was on the line, could only afford to lose support from two Republican senators, with the tie-breaking vote to be cast by Vice President Mike Pence, who was on the Senate floor.

Republicans released the skinny bill just three hours before voting began.

It would have retroactively repealed the Obamacare penalty on individuals who do not purchase health insurance, repealed for eight years a penalty on certain employers who do not provide employees with insurance and repealed a medical device tax until 2020.

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