Image copyright Reuters Image caption President Trump said Republicans who oppose the new plan "don't have the guts to vote for it"

US President Donald Trump has hit out at Republicans who are refusing to back the latest effort to repeal Obama-era healthcare legislation.

Speaking in Alabama, he said senators from his party who opposed the repeal lacked "the guts to vote for it."

Senator John McCain dealt the Trump administration's efforts a potentially fatal blow when he said he could not vote for it "in good conscience".

President Trump said his criticism was "unexpected" and "terrible".

"They gave me a list of 10 people that were absolute no's," he said. "John McCain was not on the list so that was a totally unexpected thing, terrible, honestly terrible."

"We're going to do it eventually," he added.

Republicans need 50 votes in the 100-seat Senate, which they control 52-48, to succeed. With Democrats united in opposition, the vote is now on a knife edge.

Mr McCain's objection could doom conservatives' seven-year campaign to erase former Democratic President Barack Obama's signature legislative achievement.

It is the second time Mr McCain has thwarted his party leadership on the issue.

It was wrong, he said, to pass such far-reaching legislation without input from the Democrats, and said the bill demanded extensive hearings, debate and amendment.

Media playback is unsupported on your device Media caption Mr McCain's "no" vote in July scuppered the last Republican bid to repeal Obamacare

"That is the only way we might achieve bipartisan consensus on lasting reform," he wrote, "without which a policy that affects one-fifth of our economy and every single American family will be subject to reversal with every change of administration and congressional majority."

Of other Republican senators:

Rand Paul, is also against the latest repeal bill

Susan Collins said she was "leaning against the bill" because she was worried the legislation did not do enough to protect patients with pre-existing conditions

Lisa Murkowski, Dan Sullivan, Rob Portman and Jerry Moran are undecided

Back to the drawing board

Analysis by Anthony Zurcher, BBC North America reporter

As several Republican senators explained - ones who were firm "yesses" - the main attraction for the plan was that it was the only plan on the table.

Now it appears Republicans will have to go back to the drawing board.

Although the end of September is the deadline for passing a bill with a simple majority in the Senate for this federal budget, there's no reason the party couldn't start the wheels turning for another vote next year - or, conceivably, simply change the rules, as Donald Trump has suggested.

None of that will alter the simple dynamic that made itself clear over the course of the past months, however.

The Republican Party, despite campaigning ferociously for Obamacare repeal for nearly seven years, could never agree on how to turn those promises into reality without sending the healthcare industry into a tailspin.

Read more from Anthony

Follow @awzurcher

The Republican leadership had evidently hoped Senator Lindsey Graham, one of the bill's authors, might be able to persuade his close friend Mr McCain to back the measure.

Undeterred, Mr Graham vowed: "We press on."

US Vice-President Mike Pence said the so-called Graham-Cassidy bill was the "last best chance" to repeal Obamacare.

President Trump has been phoning lawmakers and state governors in a bid to tilt the scales in favour of the bill but several Republican governors this week also criticised the process as rushed.

And 16 major medical groups issued a joint statement against the Republican legislation.

Media playback is unsupported on your device Media caption 'Trump not thinking about the little people'

Senate Majority Leader Mitch McConnell was planning to bring the legislation to a vote next week but it is unclear now if that will go ahead.

Republicans are still reeling from the collapse in July of their efforts to secure Senate passage of previous legislation to repeal Obamacare.

A dramatic late-night "no" vote from Mr McCain - just days after he was diagnosed with an aggressive brain tumour - sank that bill, too.

According to analysis by the non-partisan Brookings Institution, if the Graham-Cassidy bill were to pass, 32 million fewer Americans would have health insurance by 2027.

The new bill would give states money in block grants to run their own healthcare programmes.

But critics say that when left to the states, the money going into the Medicaid programme for people on low incomes would diminish.

Republicans have long deplored Obamacare, known formally as the Affordable Care Act, as government overreach into the US healthcare system.