Senators in the US have rejected a measure to repeal parts of former president Barack Obama’s healthcare law after a night of suspense, dealing a serious blow to President Donald Trump’s agenda.

As they were unable to pass even a “skinny repeal”, it is unclear whether Senate Republicans can advance any health bill despite seven years of promises to repeal “Obamacare”.

“This is clearly a disappointing moment,” said majority leader Mitch McConnell. “I regret that our efforts were not enough, this time. It’s time to move on.”

Mr McConnell put the health bill on hold and announced that the Senate would move on to other legislation next week.

Mr Trump responded on Twitter: “3 Republicans and 48 Democrats let the American people down. As I said from the beginning, let ObamaCare implode, then deal. Watch!”

A key vote to defeat the measure was cast by Arizona Senator John McCain, who returned to the Senate this week after receiving a diagnosis of brain cancer. In an impassioned speech on the day he returned, he had called for bipartisanship on major issues of national concern, and a return to the “regular order” of legislating by committee.

Three Republicans joined with all Democrats to reject the amendment, which would have repealed a mandate that most individuals get health insurance and suspended a requirement that large companies provide coverage to their employees. It would have also delayed a tax on medical devices and denied funding to Planned Parenthood for a year.

The final vote was 49-51. Republicans Lisa Murkowski of Alaska and Susan Collins of Maine joined Mr McCain in voting no.

The amendment was a last resort for Senate Republicans to pass something – anything – to trigger negotiations with the House.

“It’s time to turn the page,” said Senate Minority Leader Charles Schumer of New York. “We are not celebrating. We are relieved.”

Health and human services secretary Tom Price said in a statement that the Trump administration would pursue its health care goals through regulation. “This effort will continue.”

Buoyed by a signal from House Speaker Paul Ryan, Mr McConnell had introduced a pared-down healthcare bill late on Thursday which he hoped would keep alive Republican ambitions to repeal “Obamacare”.

Senate majority leader Mitch McConnell leaves the chamber after his the was defeatedSenate majority leader Mitch McConnell leaves the chamber after his bill was defeated (AP Photo/J. Scott Applewhite)

He had called his measure the Health Care Freedom Act. It was not intended to become law, but to open a path for a House-Senate conference committee to try to work out comprehensive legislation Congress could pass and send to Mr Trump.

The measure would have repealed the unpopular Affordable Care Act requirement that most people have health insurance or risk a fine from the IRS. A similar requirement on larger employers would be suspended for eight years.

Additionally it would have denied funding to Planned Parenthood for a year, and suspended for three years a tax on medical device manufacturers. States could seek waivers from consumer protections in the Obama-era law, and individuals could increase the amount they contribute to tax-sheltered health savings accounts for medical expenses.