WASHINGTON (AP) — The Senate's surprise vote was only the latest narrow escape for "Obamacare," the social program with nine lives that has survived dozens of congressional attempts to kill it, and two Supreme Court challenges.

Not to mention the massive computer crash when HealthCare.gov was launched.

The saga of the Affordable Care Act illustrates how difficult it is to do away with a government program once millions are benefiting. In the latest episode, three Republican lawmakers broke with their president and leadership to join Democrats and deliver a dramatic defeat to repeal efforts.

Sens. John McCain of Arizona, Susan Collins of Maine and Lisa Murkowski of Alaska were backed by GOP governors worried about constituents losing coverage, hospitals that didn't want to go back to being stuck with bills for the uninsured, doctors trying to keep patients healthier, and people with pre-existing conditions fearful they might be exposed to coverage denials because they let their policy lapse for a few months.

"It came down to people who didn't like 'Obamacare' realizing this was going to take away their chances for coverage," said former Rep. Henry Waxman, a Los Angeles Democrat who helped write much of the 2010 overhaul under former President Barack Obama.

Despite its problems — rising premiums, shaky insurance markets — the ACA extended coverage to about 20 million people, reducing the nation's uninsured rate to a historic low near 9 percent. It delivered by combining two approaches: subsidized private insurance, and a Medicaid expansion for low-income people that 31 states have accepted. The GOP bills would have dramatically reduced spending on both, leaving anywhere from 16 million to more than 30 million uninsured. The legislation also threatened to undermine protections for people with medical problems.

Never hugely popular, "Obamacare" actually saw an increase in support as the "repeal and replace" debate intensified.

An Associated Press-NORC Center for Public Affairs Research poll picked up what could potentially be a bigger shift in public attitudes. The July poll showed that 62 percent of Americans think it's a federal government responsibility to make sure all Americans have health insurance, a 10 point increase from 52 percent who said that in March. Among independents, there was a 13-point increase.

H.W. Brands, a professor of U.S. history at the University of Texas at Austin, said people have little investment in a program's success before they experience its benefits.

"Whichever fan of the welfare state first applied the term 'entitlements' to these benefits was brilliant," said Brands. "People come to think they are entitled to them, and heaven help the politician who tries to take them away."

Said Robert Blendon of the Harvard T.H. Chan School of Public Health: "Getting rid of the law became getting rid of coverage for 30 million people. When faced with taking insurance cards away from 20 million to 30 million people, dislike of the law in no way justified taking those cards away."

Obama's office issued a statement Friday calling attention to the broader benefits of the ACA, including free preventive care and a greater focus on improving the quality of hospitals.

Those get less notice than the coverage expansion, but affect more people. For example, contraceptives are now provided free of charge to most women, a policy the Trump administration is seeking to narrow. And when people with employer coverage get routine colonoscopies, they no longer face a copayment for the test.

"It's about the dreams protected, and the untold misery and ruin prevented," said the statement from Obama's office.

President Donald Trump, however, does not seem ready to acknowledge anything good in his predecessor's signature domestic program.

Trump talks about "Obamacare" as if it's on the verge of collapse, which does not reflect reality everywhere. The Medicaid expansion, which has added about 11 million to the insurance rolls, operates more or less on automatic pilot even if costs are a concern. Private insurance markets are in trouble in some states, but not in others. People eligible for ACA subsidies are shielded from premium increases, but not those who buy coverage outside the health law's markets, many of whom face another year of double-digit premium hikes.

Trump tweeted what appeared to be a veiled threat after the Senate vote: "Let ObamaCare implode, then deal. Watch!"

Andy Slavitt, a tech-savvy executive who helped revamp HealthCare.gov for Obama, said both political parties should essentially enter into peace negotiations in the seven-year health care wars.

"It is time for it to stop being Obamacare or Trumpcare," said Slavitt. "We need to make it something that everybody owns."

Much of the public and the private sector already seem headed in that direction, said Slavitt. The question is whether the politicians will join them. Democrats shouldn't be crowing, he said.

"Republicans are the majority party," said Slavitt. "Unless (Democrats) take in ideas from the Republican party and are open to them, we are not going to get to a bipartisan agreement."

___

Associated Press writer Laurie Kellman contributed to this report.