The Trumpcare Bonfire.

It will come as a huge relief to millions of Americans that Republican lawmakers have struck out in their attempts to destroy the Affordable Care Act — at least for now. But this ideological exercise in futility has already done great damage to the health care system.

First the good news, which came in two installments: No. 1, the Senate’s health care bill — which would have stripped 22 million people of their health insurance and increased premiums for older Americans and those with pre-existing conditions — collapsed Monday. Then, Tuesday, Mitch McConnell’s plan to repeal much of Obamacare without a replacement also fell apart as senators defected.

Now the bad news: While the Affordable Care Act is not collapsing, the Senate and House health bills and President Trump’s promises to sabotage the A.C.A. have destabilized some of the health insurance marketplaces created by that law. Nearly 40 counties in Indiana, Nevada and Ohio are at risk of having no insurers participating in the marketplaces next year; other counties will have only one company offering policies.

In addition, policies sold in the marketplaces could cost a lot more if the Trump administration carries out its threats to stop providing subsidies to insurers to lower deductibles for low-income and middle-income people. It can do that through administrative action. House Republicans sued the Obama administration to block the payments on grounds that Congress had not voted separately to appropriate the money, even though the A.C.A. had authorized them.

So far, Mr. Trump is viewing health care policy through the same narrow lens he uses for everything: his political standing. On Tuesday, he blamed Democrats for obstructing repeal and said that Republicans should “let Obamacare fail” in order to have another shot at replacing it, as if the health of millions of Americans wasn’t at stake. Compare that to what Senator Shelley Moore Capito of West Virginia said about her decision not to support a repeal-and-delay bill: “I did not come to Washington to hurt people.” The question now is which approach Congress will take.

Under the humane approach, with a stronger health care system a shared goal, Republicans and Democrats would work together to fix the marketplace problems and restore confidence among insurance companies. In counties with no insurers, Congress could require the Federal Employees Health Benefits Program to offer coverage. State governments, working with the Trump administration, could create reinsurance programs to reduce the risk that insurers would lose money because of a few very sick patients. This could lower premiums and encourage insurers to operate in sparsely populated parts of the country.

If it chooses to set partisan point-scoring aside, the Trump administration would continue subsidy payments to insurers, House Republicans would drop their lawsuit and, going forward, Congress would appropriate money for these payments so that they could not be used to undermine the health care law. Quick action is needed on all fronts because insurers and state and federal regulators must finalize rates and policies for next year in the coming weeks.

In the longer term, the 19 states that have refused to expand Medicaid under the A.C.A. ought to reconsider. The program helps lower-income, older and disabled people, with positive results for beneficiaries and the economy. It reduces uncompensated care at hospitals, and the people who receive treatment are healthier and more productive. About four million people could gain coverage if these last states expanded Medicaid, making it a big win for the country.