The US House of Representatives has narrowly voted in favour of a healthcare bill drafted to repeal and replace the Affordable Care Act, also known as Obamacare.

The measure, voted in on Thursday 217 to 213, now heads to the US Senate, where it faces an uphill battle.

Twenty Republicans went against the bill while not a single Democrat voted in favour of it.

The vote against former President Barack Obama's signature domestic achievement, which enabled 20 million more Americans to get health insurance, is President Donald Trump's biggest legislative win since he took office in January.

However, in the Senate, where the Republican majority is narrow, lawmakers are expected to subject the new bill to much greater scrutiny and skepticism.

Speaking with dozens of Republican lawmakers huddled behind him in front of the White House, Trump said he felt "so confident" that the bill would pass the Senate as well.

"It will be an unbelievable victory," he said.

Obamacare "is dead. If we don't pay lots of ransom money over to the insurance companies, it would die immediately," he said. "What we have is an incredible well-crafted [replacement plan]".

Al Jazeera's Alan Fisher, reporting from Washington, DC, said: "It is unusual, to say the least, that the president would take a victory lap before the bill passed both houses of Congress."

"So it shows how important this is to Donald Trump, to his supporters to be seen," he said.

Passed in 2010, Obama's Affordable Care Act expanded Medicaid, the government insurance programme for the poor, provided income-based tax credits to help the poor buy insurance on individual insurance markets set up by the law, and required everyone to buy insurance or pay a penalty.

Republicans have blamed it for driving up healthcare costs.

The Republican bill, called the American Health Care Act, would repeal most Obamacare taxes, which paid for the law, roll back the Medicaid expansion and slash the programme's funding. It will also repeal the penalty for not purchasing insurance and replace the law's tax credits with flat age-based credits.

"This is a step away from more government control of our healthcare and our day-to-day lives, and a return to freedom for all Americans," said Republican Representative Luke Messer.

READ MORE: #IAmAPreexistingCondition - Healthcare bill condemned

Thursday's victory came just weeks after the conservative Republican majority in the House of Representatives failed to drum up enough support to pass the motion.

The decision on March 24 to pull the plug on the Republican-proposed healthcare law replacement - hours before a scheduled vote - was a humiliating defeat for Trump.

The bill was amended for the second try, adding a modest pool of money they say would help people with pre-existing medical conditions afford coverage.

Emotional debate

An unusually emotional debate erupted on the House floor on Thursday morning as Democrats blasted the bill, saying it would make insurance unaffordable for those who need it most and would leave millions more uninsured.

"We don't even know how much this bill will cost America," Democratic Representative Joseph Crowley said during a debate on the House floor.

READ MORE: The Obamacare debate is not just about healthcare

In a push to pass the bill before representatives leave on Friday for a week in their home districts, the House voted before the bill could be assessed by the non-partisan Congressional Budget Office (CBO), which estimates its cost and effect on insurance rolls.

Republicans have said that the bill will be scored by the CBO and other fixes will be made before the Senate votes.

In a sign of the scrutiny it will face there, Republican Senator Bob Corker told MSNBC there was no way the healthcare bill would receive a quick up-or-down vote in the Senate and predicted senators would spend "at least a month" studying it.