By David Morgan and Yasmeen Abutaleb

WASHINGTON (Reuters) - The U.S. House of Representatives approved a bill on Thursday to repeal major parts of Obamacare and replace it with a Republican healthcare plan, handing President Donald Trump his biggest legislative victory but setting up a tough fight in the Senate.

With the 217-213 vote, Republicans obtained just enough support to push the legislation through the House, sending it to the Senate for consideration. No Democrats voted for the bill.

The bill's passage represented a vital step toward fulfilling a top Trump campaign pledge and a seven-year Republican quest to dismantle Democratic former President Barack Obama's signature healthcare law. But the effort now faces new hurdles in the Senate, where the House bill will have difficulty gaining Republican support.

Thursday's vote was also a political victory for House Speaker Paul Ryan, demonstrating his ability to pull together a fractured Republican caucus after two failed attempts this year to win consensus on the healthcare legislation.

Democrats are hoping that the Republicans' vote to repeal Obamacare will spark a voter backlash in next year's midterm congressional elections.

Some 20 million Americans gained healthcare coverage under Obama's 2010 Affordable Care Act, which has recently gathered support in public opinion polls. But Republicans have long attacked it, seeing the program as government overreach and complaining that it drives up healthcare costs.

The Republican bill, known formally as the American Health Care Act, aims to repeal most Obamacare taxes, including a penalty for not buying health insurance. It would slash funding for Medicaid, the program that provides insurance for the poor, and roll back much of Medicaid's expansion.

More From Missoula Current