WASHINGTON (Reuters) - The U.S. House of Representatives on Thursday narrowly approved a bill to repeal Obamacare, handing Republican President Donald Trump a victory that could prove short-lived as the healthcare legislation heads into a likely tough battle in the Senate.

The vote to repeal former President Barack Obama’s signature domestic achievement, which enabled 20 million more Americans to get health insurance, was Trump’s biggest legislative win since he took office in January, putting him on a path to fulfilling one of his key campaign promises as well as a seven-year quest by Republican lawmakers.

It marked a reversal of fortune for the Republican president who suffered a stunning defeat in late March when House Republican leaders pulled legislation to scrap Obamacare after they and the White House could not resolve the clashing interests of Republican moderates and the party’s most conservative lawmakers.

Trump has called Obamacare a “disaster” and congressional Republicans have long targeted the 2010 law, formally known as the Affordable Care Act, calling it government overreach.

But despite holding the White House and controlling both houses of Congress, Republicans have found overturning Obamacare politically perilous, partly because of voter fears, loudly expressed at constituents’ town-hall meetings, that many people would lose their health insurance as a result.

With Thursday’s 217-213 vote, Republicans obtained just enough support to push the legislation through the House, sending it to the Senate for consideration. No Democratic House members voted for the bill. Democrats say it would make insurance unaffordable for those who need it most and leave millions more uninsured. They accuse Republicans of seeking tax cuts for the rich, partly paid for by cutting health benefits.

The legislation, called the American Health Care Act, is by no means a sure thing in the Senate, where the Republicans hold a slender 52-48 majority in the 100-seat chamber and where only a few Republican defections could sink it.

As Republicans crossed over the vote threshold to pass the bill, Democrats in the House began singing “Na na, na na na na, hey hey hey, goodbye,” a rowdy suggestion that Republicans will lose seats in the 2018 congressional elections because of their vote.

Within an hour of the vote, Trump celebrated with House lawmakers in the White House Rose Garden.

“I went through two years of campaigning and I’m telling you, no matter where I went, people were suffering so badly with the ravages of Obamacare,” Trump said. “We are going to get this passed through the Senate. I am so confident.”

PRE-EXISTING CONDITIONS

The treatment of people with “pre-existing” conditions was one of the central issues in the House debate on the bill and is sure to resurface in the Senate.

Obamacare prevented insurers from charging those with pre-existing conditions higher rates, a common practice before its implementation. It also required them to cover 10 essential health benefits such as maternity care and prescription drugs.

Slideshow ( 13 images )

The Republican bill passed on Thursday would allow states to opt out of those provisions. While insurers could not deny people insurance because of pre-existing conditions, they would be allowed to charge them as much as they want.

In an analysis released on Thursday, healthcare consultancy and research firm Avalere Health said the Republican bill would cover only 5 percent of enrollees with pre-existing conditions in the individual insurance markets.

Republicans have argued that their bill would give people more choice and reduce the role of government.

Slideshow ( 13 images )

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

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

Health insurers, such as Anthem Inc, UnitedHealth Group Inc, Aetna Inc and Cigna Corp, have faced months of uncertainty over healthcare’s future. So have hospital companies, such as HCA Holdings Inc and Tenet Healthcare Corp.

CHALLENGES AHEAD

Obamacare expanded Medicaid, the government insurance program 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.

The Republican bill would repeal most Obamacare taxes, which paid for the law, roll back the Medicaid expansion and slash the program’s funding, repeal the penalty for not purchasing insurance and replace the law’s tax credits with flat age-based credits.

In a sign of the challenges ahead for the legislation, nearly every major medical group, including the American Medical Association and the American Hospital Association, and the AARP advocacy group for older Americans, strongly opposed the Republican bill. Many said last-minute amendments further eroded protection for the most vulnerable groups, including the sick and elderly.

“I’ve already made clear that I don’t support the House bill as currently constructed because I continue to have concerns that this bill does not do enough to protect Ohio’s Medicaid expansion population,” said Republican Senator Rob Portman.

While the bill’s fate in the Senate is uncertain, its House passage could boost Trump’s hopes of pushing through other big-ticket items on his agenda, such as tax reform.

The previous failure to overhaul healthcare legislation had raised questions about how much Republicans could work together to help Trump fulfill his campaign pledges.

“Anything that they (the Republicans) get done, that they accomplish, popular or unpopular, will show that they have the ability to make progress and to get things done and work together,” said Randy Frederick, vice president trading and derivatives at Charles Schwab in Austin, Texas.

“This puts the idea of tax reform a little bit closer to reality, simply because it’s shown that they have figured out a way to negotiate and work together,” he added.