In the wee hours of Friday morning, the last gasp of Senate Republicans’ efforts to repeal Obamacare died, amid applause and tears.

The last proposal on the table, the “skinny repeal”—if it can really be called a repeal—wasn’t one of the options germinating for years in conservative intellectual circles, or even the blanket return to status quo ante that Republicans had promised for years. Rather, the bill that hit the floor late Thursday night was written earlier that day at lunch. It was a slapdash scramble from Majority Leader Mitch McConnell to roll back something in Obamacare after months of stalled bills, protests, and rapidly deteriorating public opinion.

The seeds of McConnell’s failure were planted way back in January, when House Republicans finally began to deliver on seven years of promises on repealing Obamacare. The first signs of inter-party discontent came with the earliest decisions as a new governing party, as GOP leaders couldn’t decide whether they wanted to just repeal Obamacare altogether—and thus absorb the political risks of something on the order of 30 million uninsured people—or use the opportunity to replace Obamacare with a more conservative health-care paradigm. They weren’t helped by the fact that President Trump displayed Heisenberg-like uncertainty regarding the White House’s official stance on that front.

In the end, ambition won out, and House Speaker Paul Ryan began the task of reshaping the U.S. health care system in the GOP’s image. And despite having almost a decade to trial-balloon policy alternatives and develop an ideological braintrust to achieve his “Better Way,” the effort highlighted just how woefully underprepared Republicans were.

The first official draft of the American Health Care Act, that leaked in late February and was released in early March, was, simply, a policy dead-end. It attempted to marry all three of Ryan’s pet projects: A major tax reform, a mass insurance industry deregulation, and substantial cuts to Medicaid, a program that largely serves low-income children, elderly and disabled people.

For the first aim, the AHCA repealed a number of taxes paid disproportionately by high earners. For the second aim, the House bill repealed the Affordable Care Act’s mandates for purchasing insurance; replaced Obamacare tax credits for purchasing insurance with a much less generous refundable, age-rated, income-capped tax credit; and also allowed the plans that qualified for those credits to provide fewer benefits on average. For the third aim, the AHCA would sunset the ACA’s Medicaid expansion to able-bodied low-income adults, would implement Medicaid work requirements, would defund Planned Parenthood, and would restructure the Medicaid program from open-ended funding based on costs incurred to a hard per-capita cap.

The rough shape of that plan endured through successive rewrites, but the finer policy points were disasters, initially. The lack of a mandate and the meager tax credits created cartoonish bubbles in exchange markets, and created scenarios where costs for low-income and older people might see their premiums rise by a factor of 10 in the space of a few years. The AHCA attempted to inject some money into reinsurance and high-risk pools with a special fund to offset some of those distortions, but the fund was a few orders of magnitude too small.

Additionally, massive Medicaid cuts would reduce covered people and services by millions, while the less generous tax credit meant those low-income enrollees would have no place to go. That this divestment from poor people’s health came at the same time as tax cuts for high earners meant the AHCA was an exercise in upward wealth redistribution.

Despite Ryan’s most earnest efforts—and PowerPoint presentations with carefully rolled-up sleeves—those policy gaps were too wide to paper over. Faced with angry throngs of constituents fearing they’d lose coverage, moderates in the party revolted. Conservatives in the Freedom Caucus who wanted more of a straight repeal and called Ryan’s scheme “Obamacare-lite” also distanced themselves from Ryan. By the end of March, it appeared Ryan’s plan was dead in the water. Campaigning to end Obamacare was easy. Governing was harder.

But Republicans really wanted to repeal Obamacare—some of them had made their names in politics almost exclusively on promises to do so—and Ryan used that eagerness to his advantage. Over the course of weeks of amendments and tweaks, House leadership began the process of shoring up some of the more obvious flaws in the AHCA and bringing conservatives and moderate wings aboard. To that end, they bolstered the “Patient and State Stability Fund” to provide more reinsurance funds to states. They also implemented provisions that would allow states to further deregulate insurance plans and allow more barebones plans to receive tax credits.

With some arm-twisting and a rushed vote without a Congressional Budget Office score, despite fears—later confirmed—that the plan would leave upwards of 20 million more people uninsured, the House managed to pass the AHCA, but in doing so passed on many of their pet bill’s instabilities to the Senate.

The Senate’s version of the bill continued the House’s trend of sanding some of the rougher edges of the AHCA, all while adding piecemeal amendments to keep both wings of the party happy. The Better Care Reconciliation Act reversed what Trump called the “mean” tax-credit structure of the AHCA, and created a structure that was largely similar to, but slightly less generous than, Obamacare’s existing structure. In doing so, it decreased some of the more extreme disruptions of the AHCA’s deregulations and defunding on premiums, but not enough to avoid another CBO score indicating the bill would increase the number of uninsured people by over 20 million.

But McConnell is no Ryan, and facing public outcry and rumblings among both moderates and conservatives, he went underground, crafting follow-up deals and amendments that could get him 50 votes, all while maximizing secrecy and public confusion. During that process, McConnell added more long-term cuts to Medicaid and more insurance deregulations. But those additions to mollify conservative members of McConnell’s conference reduced the bill’s support among moderates. McConnell’s balancing act fell apart when conservative members defected as well, citing what they saw as a the legislation’s similarity to Obamacare.

Faced with those defections, McConnell tested a few new strategies, including a dead-in-the-water vote to simply repeal Obamacare, but it seems the real strategy was already taking shape: McConnell intended to begin the reconciliation process, get disparate wings of his party to the table with amendments, and create a repeal option that rolled back only the parts of Obamacare that his caucus agreed should go, then perhaps get that legislation into a House-Senate conference to add more pieces.

His strategy was thrown in jeopardy by the Senate parliamentarian’s denial of some of many of those critical amendments and sweeteners, but the final option still held. It was the skinny repeal or nothing, and McConnell wouldn’t let the CBO, the parliamentarian, or public opinion get in the way of passing something.

In the end, it was McConnell’s expedient—but scorched-earth—approach that would undo his work. The “skinny repeal” is just not good policy, and nobody likes it. That was known before a last-minute CBO score found that the provisions repealing the Obamacare mandates while retaining its insurance regulations and tax credits would decrease coverage by 16 million while increase premiums. McConnell’s pitch was that the legislation could be amended through the reconciliation conference process, and that senators who held their noses and voted yes would get what they wanted down the road.

Essentially, as my colleague Russell Berman notes, McConnell had created a legislative process so convoluted that he ended up asking his party to vote for a law that they didn’t want to actually become law. And they almost did. If not for a late switch from Arizona Senator John McCain and Alaska Senator Lisa Murkowski’s ability to withstand withering pressure from the White House and her fellow senators, the skinny repeal would have passed, and the House would have been under no obligation whatsoever to amend it.

Although McConnell’s gambit failed, the real story might be what almost was: Faced with the real possibility of knowingly passing an Obamacare “repeal” into law that only would have destabilized markets and sloughed more people off coverage, and would have met none of their stated policy goals to reduce premiums and make insurance work better for patient, Republicans almost caved. The incentive to do anything to destroy Obamacare, even while damaging their own party, leaving millions uninsured, and “owning” the fallout, was almost too great.

With the skinny-repeal debacle, Republicans all but validated the criticisms of legions of disability activists, Planned Parenthood supporters, doctors, insurers, and people with pre-existing conditions. Their final plan did not pretend to listen to those concerns, nor when faced with difficulties, did Republican leadership seek to incorporate their concerns by bringing back regular order.

And therein lies Republicans’ central problem: Obamacare repeal is an ideological platform with little policy basis or real input from health stakeholders. It’s a reactionary position with few guiding principles. Although conservative efforts to build rational, data-driven defenses of 2017 repeal legislation have advanced as those bills matured, evidence is still thin that Republican plans can legitimately improve care for everyone, and most supporting analyses rely on fuzzy numbers and torturous logic. There are few rigorous reports that a plan resembling theirs could provide “flexibility” or “freedom” to both the sickest Americans and the healthiest.

That central problem has shifted the political landscape, as Americans’ views on health policy have changed dramatically in a short amount of time. Polling plummeted for the BCRA, to the point where only 17 percent of Americans, and only 35 percent of Republicans supported the legislation during its dying days. Meanwhile, Kaiser Family Foundation polls show support for single-payer programs growing over the past few years, even slightly among Republicans and sharply among independents. Simply, although Republicans came to power on promises to repeal Obamacare and perhaps replace it with something better, because of their own failures they no longer possess that mandate.

Perhaps Republicans could use the road ahead as a way to brainstorm policy ideas that could use the free market to expand coverage and affordability—or find a way to embrace a political message that admits their plans have never had much interest in doing so.

But it’s more likely that the GOP will continue down the same course McConnell charted over the past few weeks. The wheels were turning just hours after the skinny repeal’s failure, as Congressman Mark Meadows told Fox News that Republicans are now “going to go back to work to make sure we get a bill.” Repealing Obamacare is now clearly the guiding ethos and spirit of the party, whether it comes with the consent of the governed or not.