WASHINGTON (NYTIMES) - In voting to repeal former United States president Barack Obama's signature healthcare law, House Republicans finally made progress on a key Trump administration goal and on a campaign promise that they have made for the better part of a decade - but at a potentially steep price.

After failing to get the votes for an original replacement measure in March, House Speaker Paul Ryan worked tirelessly to do what his predecessor John Boehner could not - bring together his most conservative members and their moderate colleagues behind a piece of legislation laden with political peril.

The victory may give momentum to the rest of President Trump's agenda - particularly the arduous task of rewriting the tax code - and it helps restore Mr Ryan's reputation, at least for now. No longer is he the guy who speaks loftily about policy but cannot deliver results; now he has proved that he can produce the votes. His volatile relationship with Mr Trump, too, may settle down for now.

But by leaning on members to vote for a Bill that many fear will leave millions of people unable to afford healthcare, Mr Ryan has exposed moderate Republicans to withering political attacks.

This is especially true in the roughly two dozen districts represented by Republicans where Hillary Clinton prevailed over Mr Trump in November, but it is also the case in places where the Affordable Care Act's popularity has been increasing.

"If you're in a very moderate-to-Democratic district - yeah," said Republican New York Representative Peter King conceding the potential risk to Republicans.

In reshaping the bill, Mr Ryan worked with an attentive White House, edging out the committee chairmen who helped write the original measure and turning to conservative lawmakers, moving the bill significantly to the right in the process. It also empowered conservatives who many Republican leaders had hoped to marginalise in the era of Mr Trump.

The president's economic populism and flexibility on policy seemed at first to be totally out of step with the far-right members, who essentially ran Mr Boehner out of town. So the health Bill's passage could augur high-stakes spending and policy fights ahead.

"This is definitely a win for the Freedom Caucus," said Charlie Sykes, the former conservative radio host and long-time friend of both Mr Ryan and Reince Priebus, Mr Trump's chief of staff. Mr Priebus made getting a healthcare Bill passed in the House a career-defining moment for himself, and he negotiated at length with the conservative lawmakers. Mr Ryan singled him out for praise at a Rose Garden ceremony after the vote.

"They moved the Bill right and the moderates caved," Mr Sykes said. "That creates an interesting dynamic."

To get his victory, Mr Ryan cast aside many promises he had made when he became Speaker about transparency and moving Bills through committees and a process. Instead, he threw together Bills without hearings, made back-room side deals to buy off individual lawmakers, and held votes on measures before the Congressional Budget Office could put a price tag on them.

The process alienated committee chairmen, whose work took a back seat to the efforts of the elusive chairman of the House Freedom Caucus, North Carolina Republican Representative Mark Meadows and it chipped away at their authority. Mr Meadows and his fellow conservatives, who have toiled for years as philosophical bomb throwers in the legislative process, got the attention of the White House, which worked hard to meet their needs and pressure moderates to come along.

Mr Ryan spent much of April calling and visiting colleagues in order to get the measure passed. But in the end, there is little guarantee that the Senate will be able to live with the House Bill. This is particularly true for senators from states where Medicaid coverage expanded under Mr Obama's program. "Senate Republicans may look back on the appeasement of the Freedom Caucus as a poison pill," Mr Sykes said.

That sentiment was already being felt in the House. "Members have been asked to vote for a Bill that is particularly treacherous, that is going nowhere in the Senate," said Representative Charlie Dent, the Pennsylvania Republican who has led the opposition among moderates. "This legislation will be gutted and we will have voted for a Bill that will never become law. Will it cause headaches for people? Absolutely."

At the very least, the Senate will take far longer to get its legislative process going. And whatever it passes could be so far from the House version that no compromise between the chambers can be attained. Republicans may even face a replay of the situation House Democrats faced in 2009 when they voted for a politically risky cap-and-trade Bill that the Senate never took up. Many of them ended up losing their seats.

"I sincerely hope that the Senate won't mimic the House and try to rush a Bill through without hearings or debate or analysis," Senator Chuck Schumer of New York, the Democratic leader, said on the Senate floor on Thursday.

Mr Schumer gave a preview of the Democratic blitz facing House Republicans - who will return to their districts for a week off to gauge voters' reactions - describing the measure as a "breathtakingly irresponsible piece of legislation that would endanger the health of tens of millions of Americans".

Republicans are bracing for those encounters. "They're not going to be less angry," said Representative Bill Huizenga of Michigan, referring to the town hall meetings he has held with angry voters. "But what I am also hearing back home is that most people expect us to do something and I've been saying I want to do this since 2009. So this would not be a surprise for anyone who voted for me."

Republicans knew there might be political costs, especially with energised Democrats looking to beat back Mr Trump's agenda and make a run at retaking the House in 2018. But they bet that their own base was depressed by the Republicans' inability to repeal the healthcare law, and that the issue would generate needed energy.

"The upside for Republicans is that they can return to their districts and tell GOP voters that they acted on a campaign promise," said Nathan Gonzales, the editor of Inside Elections. "The downside is that the alternative may not go far enough for base Republicans, may go too far for moderate voters, and create a backlash that puts the House majority at risk in 2018."

On Thursday, a united Republican front presented their floor vote as a rescue mission, a unity exercise and a moral imperative. "Everyone was talking about how this was the moment to save Americans" from the current healthcare law, said Representative Vicky Hartzler, a Republican of Missouri. "We're proud of this product," she said.