House Republican leaders on Friday pulled their bill to repeal the Affordable Care Act, signaling defeat on what was supposed to be a major legislative accomplishment for President Donald Trump.

The news was first reported by Robert Costa of The Washington Post, who spoke to the president directly, following a meeting between Trump and House Speaker Paul Ryan (R-Wis.).

Trump said he agreed to pulling the bill once Ryan made it clear the legislation lacked the votes to pass.

In subsequent remarks, both Trump and Ryan indicated they were ready to move on from health care to other issues.

The failure to pass the bill represents a devastating defeat for Trump and Ryan ― and throws into doubt a crusade that has defined Republican politics for over seven years.

“We came really close today, but we came up short,” Ryan said at a press conference. “This is a disappointing day for us.”

The news capped a week of chaotic activity at both ends of Pennsylvania Avenue, as Trump, Ryan and their lieutenants tried desperately to round up votes for the measure they introduced less than three weeks ago ― which they were attempting to move through the legislative process at breakneck speed.

Less than 24 hours before, Trump had issued an ultimatum to the House, demanding a vote on what both he and Republican leaders had identified as a top legislative priority ― and threatening to move on to other legislative items if they refused.

Trump’s demand was an audacious act of political brinkmanship, designed to rattle and win over dissident Republican lawmakers who, for various reasons, were objecting to the bill.

But the gambit failed, and it failed spectacularly.

As for the current health care law, on which some 20 million people depend for insurance, its odds of survival seem better than at any time since Trump’s election, when its repeal seemed nearly inevitable.

“We’re going to be living with Obamacare for the foreseeable future,” Ryan admitted Friday. “I don’t know what else to say other than Obamacare is the law of the land.”

What The GOP Bill Would Have Done

The American Health Care Act, the Republican proposal to replace the ACA, would have amounted to arguably the single biggest rollback of a social welfare program in American history.

The bill would have ended Obamacare’s expansion of Medicaid eligibility and cut funding for the rest of the Medicaid program going forward. It would have scaled back regulations on what insurance covers. It also would have redistributed financial assistance, so that people with lower incomes and higher insurance costs would get less than they do today ― even as more affluent people would qualify for substantial new subsidies.

The bill would have made some other major changes, as well ― such as ending the “individual mandate,” the unpopular financial penalty for people who do not get health insurance, and rolling back new taxes on the wealthy and health care companies that the government uses to finance the law’s coverage expansion.

During the 2016 campaign and in the early days of his presidency, Trump had promised not just to repeal the Affordable Care Act, but to replace it with “great health care” and “insurance for everybody.” But when the Congressional Budget Office analyzed an early version of the GOP proposal, it predicted the number of people without insurance would increase by 24 million over the next decade, going up by 14 million in 2018 alone.

Declining government spending would reduce the federal deficit, the CBO predicted in that report, and average premiums for people buying coverage on their own would end up lower than they would have been otherwise. But those lower premiums would be a byproduct of older and sicker people dropping insurance altogether ― because insurers would have made it too pricey for them, and because the plans available on the market would have tended to cover much less.

Why GOP Leaders Couldn’t Get The Votes

Those findings, which the CBO published early last week, halted the political momentum the repeal legislation had gained when it sailed through two committee votes earlier this month. As Trump administration officials and House Republicans began preparing for consideration by the full House, they quickly realized the bill lacked enough support to pass.

Over and over again, GOP leaders argued that their proposal represented the party’s best chance to kill Obamacare. But efforts to corral Republicans failed, in part because leaders were dealing with two separate groups with divergent interests.

More conservative members, led by the House Freedom Caucus, were angry that the bill left some of the Affordable Care Act’s insurance regulations in place. Those regulations, they suggested, would keep premiums from falling further ― although the precise relationship between each of these regulations and actual premiums is murky.

More moderate members, many of them from Democratic-leaning states and states that used Affordable Care Act money to expand Medicaid, worried that the bill would take away insurance coverage from too many people ― and that, if premiums really did come down, they would do so only by increasing out-of-pocket costs for people who held on to their coverage.

Put more simply, conservatives worried that repeal didn’t go far enough, while moderates worried that it went too far. Every effort Republican leaders made to appease one group alienated the other.

Complicating matters further, Republicans have been trying to pass repeal legislation through “budget reconciliation” ― an expedited process that would allow Republicans to get a bill through the Senate without the threat of a Democratic filibuster, so that a simple majority vote would be sufficient.

Reconciliation rules stipulate that only provisions with a direct effect on the federal budget may get consideration through this process. That could exclude many of the regulatory changes that more conservative Republicans want to make, like changes to rules regarding what insurance covers. These rules also require the legislation, on net, to reduce the budget deficit.

And on top of everything else, Republicans were fighting an increasingly skeptical public. Multiple polls have suggested the GOP measure is deeply unpopular, while the law it aimed to replace, long the subject of controversy and the object of scorn among conservatives, is now becoming more popular.

Late this week, Trump and GOP leaders agreed to modify the bill by eliminating a requirement that all insurance plans cover “essential” benefits, such as mental health and maternity care, and then offering special funds to cover the costs of precisely those services. Experts immediately warned that making these changes could dramatically alter health insurance markets, making it difficult to find comprehensive coverage as insurers would gravitate toward offering less generous policies.

The precise effects of those changes on insurance coverage and the federal budget are unknown ― because Republican leaders, determined to rush a vote, would not allow time for the CBO to analyze the changes. In fact, it wasn’t until late Thursday evening that leadership posted the text of the changes.

In the end, however, the effort was for naught. Leaders couldn’t come up with language that would draw enough votes from the two holdout GOP factions to overcome the unified opposition of Democrats.

“I think that there were mistakes in many corners from the beginning of the process,” Rep. Justin Amash (R-Mich.) told The Huffington Post on Friday. “The responsible thing to do is keep legislating. My reaction is that when something fails, you keep trying.”

Why The Health Care Debate Isn’t Going Away

Regardless of what happens now, health care is likely to remain a subject of controversy.

The Affordable Care Act is responsible for historic progress, bringing the number of uninsured Americans to a record low, thereby improving access to care and bolstering financial security. But millions of people are unhappy with their coverage, and in some states, newly regulated insurance markets have struggled ― with premiums rising even higher and insurers, stung by financial losses, pulling up stakes.

The Obama administration expended tremendous effort shaping and nurturing the new system during its infancy and addressing problems as they came up. Now the Trump administration is in charge of managing these marketplaces, and its intentions are not clear.

Trump has said more than once that politically speaking, the easiest choice for Republicans would be to sit back and let the system operate on its own. Doing so, Trump predicted, would lead to a total collapse.

This article has been updated with Amash’s comments.

Laura Barron-Lopez contributed reporting.