Media playback is unsupported on your device Media caption Protesters yell 'shame' at politicians over healthcare bill

The US House of Representatives has passed a healthcare bill, bringing President Trump's pledge to repeal and replace Obamacare a stride closer.

The American Health Care Act (AHCA) passed with a vote to spare, after weeks of cajoling within the Republican party to muster enough support.

Democrats were unanimously opposed and their House leader Nancy Pelosi called it a "cowardly choice".

President Trump predicted this "great plan" would now get Senate backing.

"Make no mistake, this is a repeal and a replace of Obamacare," he said from the Rose Garden at the White House, soon after the vote.

Media playback is unsupported on your device Media caption Trump and Republicans cheer vote on healthcare

Its safe passage through the US lower chamber provides the new president with his first legislative victory, three months into his term.

And it marks a remarkable turnaround after the bill was left for dead in March when Republicans were unable to agree on its provisions.

But it was a close-run thing - Republicans needed 216 votes in the House and it passed with 217. No Democrats voted in favour.

Obamacare v Republican plan compared

Trump health bill: Winners and losers

Five consequences of healthcare vote

A win for Trump - Anthony Zurcher, BBC News, Washington

Round one of the battle over Obamacare repeal is in the books. Round two is set to begin, with the opponents more powerful and the obstacles more imposing.

It's worth remembering that passage of the Republican healthcare plan in the House of Representatives was supposed to be the easy part. House Speaker Paul Ryan had a sizeable majority at his disposal and the political tools to reward support and punish transgressions.

Instead the American Health Care Act's long, laborious journey exposed divisions within the Republican Party and the limits in Donald Trump's powers of persuasion. These challenges won't disappear. The fault lines will be put under greater pressure and Mr Trump's skills will be further tested when action heads to the Senate.

Unlike the House, the Republican majority there is narrow, and already some in the party are showing misgivings about the current legislation. Democrats, who have more parliamentary tricks up their sleeves, will attempt to disrupt the process at every turn.

Still, a win is a win. It wasn't pretty. It may not last. But Mr Trump and the Republican House leadership will take it.

Media playback is unsupported on your device Media caption Trump's battles with Obamacare - in his own words

But the speed at which it has been resuscitated since then, with several amendments aimed at winning over Republican rebels, has provoked criticism.

It is not known how much the revised bill will cost, nor how many people will lose coverage, because the nonpartisan Congressional Budget Office (CBO) has not had time to assess it.

Before the latest revisions, the CBO estimated 14 million more Americans would lose insurance in 2018 alone.

Why is Obamacare suddenly so popular?

Patients tell their Obamacare stories

About 20 million Americans gained healthcare coverage under President Barack Obama's 2010 Affordable Care Act, nicknamed Obamacare.

But Republicans viewed it as an overreach of the federal government and said patients had less choice and higher premiums.

What's the reaction?

Image copyright Getty Images Image caption Activists hold signs during a "Stop Trumpcare" rally in front of the Capitol in Washington, DC

There were shouts of "Shame on you!" from protesters directed at congressmen and women as they left Capitol Hill.

Democratic Minority Leader Nancy Pelosi said: "Very sad. One of the biggest transfers of wealth in the history of our country. Their desire to give a tax break for the rich just trumped everything."

But Republicans were jubilant.

House Majority Leader Kevin McCarthy said the bill would give Americans greater choice and stop the current Obamacare "death spiral" of higher costs and fewer healthcare options.

The White House Chief of Staff Reince Priebus said it was a "big win for Americans" and would deliver expanded access and lower costs.

Before the vote, the Republican leadership in the House played "Eye of the Tiger", the pre-fight song in Rocky, at a closed-door meeting.

Image copyright Getty Images Image caption The vote was a victory for House Speaker Paul Ryan (centre)

What's changed from Obamacare?

The new bill repeals the individual mandate requiring those who can afford it to have health insurance. Those have who been without coverage for more than two months would face a 30% surcharge for new policy.

It repeals Obamacare's requirement for companies with 50 or more staff to provide insurance coverage for employees.

It keeps the popular Obamacare element allowing children and young people to stay covered on their parents' policies up until age 26.

It would enable insurers to charge at least five times as much to older customers.

It enables states to opt out of the guarantee to provide healthcare to people with pre-existing conditions.

What next?

The bill goes to the Senate, probably next month, where it faces a precarious passage.

Although the chamber is Republican controlled, their majority is a thin one and several of their senators said after the House victory they will write their own bill rather than amend that one.

The influential Senator Bob Corker said the present bill had "zero" chance of clearing the upper chamber.

Any new revisions made by the Senate would need approval from the House.