To invert an old cliché: You lose some, you win some.

After failing twice in recent weeks to advance an overhaul of health care in the House of Representatives, a nail-biting vote Thursday finally scored U.S. President Donald Trump a temporary legislative victory. But it didn't come without some stumbles, revealing ruptures in his Republican Party ahead of another major policy challenge.

Trump now wants to revamp the tax system. And if he thought cutting deals on health care was tough, tax policy experts say the president will soon learn how onerous it can be to try making sweeping changes to the labyrinthine tax code.

Is it harder to climb Kilimanjaro or another mountain that's just as high? That's health-care reform and tax reform. - Michael Graetz, Columbia University professor of tax law

A House Republican blueprint on taxation proposes dramatically changing the system, said Martin Sullivan, a former Treasury Department tax specialist and chief economist for the non-profit Tax Analysts research organization.

"We're talking about the basic way we do our taxes. The number of technical issues is enormous," Sullivan said. "If you had the 100 smartest tax lawyers in town sitting in one room working day and night, it would take months to figure this thing out.

"And that's just without the politics."

'Dissension in the ranks'

Getting to Thursday's narrow 217-213 vote to repeal key parts of the Affordable Care Act (ACA), also known as Obamacare, was not only a struggle between Republicans and Democrats, but between hardline and moderate factions within the GOP itself.

Republicans were still changing sides just a day before the vote. An amendment to add $8 billion to help cover insurance costs for people with pre-existing conditions brought a pair of influential moderates to Trump's side.

The moderate Tuesday Group of roughly 20 House Republicans reportedly threatened to oust their co-chairman for brokering a deal with the Freedom Caucus on an amendment to allow states to apply for waivers to opt out of some requirements of Obamacare, including the provision for maternity care.

"There is dissension in the ranks," one Tuesday Group member told The Hill.

None of which bodes well for tax reform, said Dean Zerbe, national managing director at the tax consulting firm Alliantgroup.

"The idea that they couldn't quickly come to an agreement on where they wanted to be on ACA raises concerns about where they're going to be on taxes," said Zerbe, who served as senior counsel and tax counsel to the Senate finance committee during the George W. Bush administration.

Promises to keep

It's unlikely the Senate will allow Trump's American Health Care Act to become law in its current form, and would send it back to the House for major revisions, effectively killing it. All that congressional arm-twisting, in other words, was likely for the sake of a symbolic win.

Tax reform was another campaign pillar, but there's a reason it hasn't been achieved since 1986, said Michael Graetz, a former Treasury Department tax adviser.

"Is it harder to climb Kilimanjaro or another mountain that's just as high?" he said. "That's health-care reform and tax reform. They both have plenty of difficulties."

Treasury Secretary Steve Mnuchin has said tax reform would be "a lot simpler" to tackle than health care, but the tax system is riddled with loopholes and a thicket of provisions backed by powerful interests.

Economists following the issue expect a repeat of the kind of Republican bickering that divided ultraconservatives and moderates over details in the health-care bill.

There's the hotly contested issue of levies on imports, for example. Some groups, such as the influential Americans For Prosperity, founded by the billionaire arch-conservative Koch brothers, as well as large retailers like Walmart, dislike the idea of a "border adjustment" tax that would place a 20 per cent tax on all imported goods. Influential House Republicans such as Speaker Paul Ryan favour the provision.

The tax, which would raise about $1 trillion in revenue, is already a sticking point.

Treasury Secretary Steve Mnuchin has said tax reform would be 'a lot simpler' than health care. (Pablo Martinez Monsivais/Associated Press)

Republican reluctance to embrace the president's priorities was also clear in the $1-trillion bipartisan spending bill. The House advanced the bill to keep the government running through September, but it was negotiated between Republicans and Democrats, cutting out key White House priorities. The measure omitted funding for Trump's border wall, excluded his proposal to defund Planned Parenthood and denied him a crackdown on sanctuary cities.

In response, Trump blamed the bipartisan compromise for denying his campaign promises and called for a government shutdown.

"Our country needs a good 'shutdown' in September to fix mess!" he tweeted on Tuesday.

The reason for the plan negotiated between the Republicans and Democrats is that we need 60 votes in the Senate which are not there! We.... —@realDonaldTrump

either elect more Republican Senators in 2018 or change the rules now to 51%. Our country needs a good "shutdown" in September to fix mess! —@realDonaldTrump

If Trump encouraging a government shutdown was meant to be a leverage play to get a more favourable spending package in the fall, pundits warn it might backfire. Republicans are now more likely to shoulder the blame should it actually happen.

Thursday's health-care vote may have been a Pyrrhic victory, but it was much-needed for the new administration. Trump, beaming in the Rose Garden, praised the effort to unite enough Republicans to support the Obamacare replacement bill.

"We have a lot of groups. And they all came together … we have really developed a bond," he said.

Then, he teased his next legislative initiative: "The biggest tax cut in the history of our country.

"We're going to get that done next."