So far, one thing has saved the Affordable Care Act from Republicans’ efforts to repeal it: When the votes counted, at least three Republican senators — along with every Democrat in the Senate — could not accept massive cuts to Medicaid.

Yes, Medicaid: a 50-year-old program targeting the poor and the near poor, a cornerstone of LBJ’s Great Society.

There’s a lesson here for people who want to preserve, and strengthen, the social safety net. Medicaid’s resilience calls into question conventional wisdom about which social programs are the most vulnerable to public backlash. It’s long been thought that “targeted” programs like welfare or Medicaid are more vulnerable to repeal or retrenchment than universal programs like Social Security.

An aphorism credited to the English social scientist Richard Titmuss holds that “programs for the poor are poor programs,” meaning they are unlikely to win enough public or political support to be well-funded and resilient. In 1993, the Harvard sociologist and political scientist Theda Skocpol argued, in the influential book The Missing Middle: Working Families and the Future of American Social Policy, that programs that serve “a broad, cross-class constituency,” on the model of Social Security, are the most likely to thrive and become untouchable.

The presidential election of 2016 revived the debate about the merits of universal programs and the risks of targeted policy: Universal programs are not only resilient, the argument goes, but can create social cohesion, a sense of shared purpose, and political benefits for their advocates. Mike Konczal wrote recently that the debate among progressives over the concept of free college revealed two contrasting rhetorical approaches: a “language of access and need” (targeted aid) versus a unifying “language of rights” (free college).

Similarly, in her recent book White Working Class, Joan Williams attributes the Democratic Party’s losses in 2016 to resentment over means-tested programs, which she calls “a recipe for class conflict” and recommends avoiding completely. The alternative, universality, is central to the appeal of single-payer health care, universal basic income, and the more robust versions of free college, all key ideas in the emerging progressive agenda.

Yet in the health care showdown, it was a means-tested program, one benefiting the poor and near poor, that clearly played the pivotal role in protecting the ACA. Republican governors, including Nevada’s Brian Sandoval and John Kasich of Ohio emboldened their senators to stand up to President Trump and Senate Majority Leader Mitch McConnell in opposition to a bill that would, among other things, phase out the expansion of Medicaid (which both Nevada and Ohio had embraced) and set spending caps on the core Medicaid program.

The political potency of Medicaid was evident in Republicans’ last-ditch and futile vote on a “skinny repeal” — a proposal that dropped most changes to Medicaid. Sen. Dean Heller (R-NV) even attempted to protect his reelection hopes by sponsoring a meaningless “sense of the Senate” amendment affirming the value of Medicaid.

Programs for the poor are not by definition vulnerable

There’s no denying that some targeted programs have proved to be open to attack. As Skocpol showed, early programs to support poor mothers and their children didn’t take hold; the Reagan administration diced up dozens of small, targeted programs, and welfare was a political cudgel for decades, until the welfare reform law of 1996, which so diminished the program that it now helps barely a million households.

But other programs, such as the State Children’s Health Insurance Program, which gives states money to pay for health coverage for near-poor children (and is up for reauthorization this year), have been uniformly popular. When President George W. Bush vetoed an expansion of SCHIP, more than 80 percent of Americans said they opposed the veto.

The Affordable Care Act, as a whole, does not fit neatly into either the “targeted” or “universal” box. It’s a complicated amalgam of both elements. One piece, the structure of exchanges and subsidies for the individual market, is quasi-universal: Anyone can purchase health insurance on the exchanges the law creates. Federal subsidies make premiums affordable for people earning up to 400 percent of the poverty line, or about $80,000 for a family of three.

In practice, about 10 million people are purchasing insurance on the exchanges, far fewer than get health coverage through an employer; however, the availability of the option gives anyone security if they want to quit their job or work on their own. (Some fault the Obama administration for not emphasizing this universal aspect of the ACA, but the president and his staff evidently made the political judgment that it was better to reassure the insured majority of people that the employer-based plans they liked wouldn’t be affected.)

The second component of the ACA constitutes reforms to the insurance industry — prohibiting lifetime and annual limits, as well as discrimination based on age or health status, and requiring coverage of preexisting conditions. It also includes the popular rules allowing young adults to remain on their parents’ plans. These rules also include the mandates on individuals to hold insurance, and on large employers to offer it. Such provisions are universal in that they affect employer-provided as well as individual and small-group health insurance plans.

The third component is the expansion of Medicaid, which — although it was only implemented in 32 states — still reduced the number of uninsured by more than the exchanges and subsidies.

Some of the universal provisions have been highly popular -- especially the requirement to cover preexisting conditions and to allow young adults to remain on their parents’ insurance. But the most hated provision of the law, the individual mandate, is also part of the universal package, and can’t easily be separated from the preexisting conditions provision.

The ACA offers a mix of “universal” and “targeted” provisions

The universal provisions surely had a lot to do with the ACA’s resurgent popularity as it came under attack: Obamacare finally achieved solid majority support in the past year. Some of the universal provisions, like the ban on denying insurance to people with preexisting conditions, became so politically resilient that congressional Republicans got stuck trying to repeal the law without touching them. (Others couldn’t be included in a bill that adhered to the arcane rules the Republicans used to avoid a Senate filibuster of health care reform.) The central deception in the seven-year crusade against the ACA was the claim that Republicans could keep the popular universal provisions while repealing the rest of the law.

How did Medicaid prove to be so important in the debate over repeal? The story is more complex than just public opinion, since the key constituency was governors, not Medicaid recipients themselves. For governors, Medicaid is the single largest stream of federal funding into their budgets, which most are required to balance. While the legislation promised flexibility with federal Medicaid funds, flexibility is no substitute for predictable, adequate funding.

Still, plenty of Republican governors passed up these funds between 2011 and 2017, and there was no reason to expect that governors would suddenly care. But the constituency is now large enough to matter, the opioid crisis has made the need for Medicaid funding particularly acute, and just a few key governors were enough to swing the handful of senators necessary to kill the bill.

Is there a secret ingredient that protects some targeted programs from the vulnerability of “poor programs”? Some have suggested that programs for children, or those designed visibly and exclusively for people who are working, are more secure. The political resilience of SCHIP and the earned income tax credit support that view.

Programs may also become entrenched if they have a secondary constituency with political clout: In addition to the example of governors supporting Medicaid, there’s a long history of the agriculture lobby supporting food stamps (now known as SNAP), because it increases demand for their products. And needless to say, it helps if the program is not perceived as benefiting primarily racial minorities, as welfare was.

But the newfound enthusiasm for Medicaid might suggest another answer: Programs that are expansive enough to support a substantial portion of the working poor — and not just the destitute — can do just fine. Medicaid began as a program for the very poorest, those eligible for welfare, but a series of expansions starting in 1989 nudged it slowly up into the range of the working poor. That had the additional effect of making the beneficiary population whiter and more familiar.

The ACA expansion, which covered families up to 185 percent of the poverty threshold, was the capstone in this long process. The result is a program that, while still means-tested and targeted, now reaches enough people, and has enough secondary beneficiaries such as governors and hospitals, that its future is likely as secure as a “cross-class” universal program would be.

The knowledge that programs don’t need to provide universal benefits to build strong political support should give progressives greater flexibility, when the opportunity comes, to design programs that directly address need. We don’t always have to spread benefits thinly across the entire population in order to achieve lasting social progress.

That means, for example, that we could ensure college access for most Americans without unnecessary subsidies for those who can already pay for it, or provide an income guarantee without the expense of a truly universal basic income. When the time comes to design more progressive social policies, that freedom will be valuable.

Mark Schmitt is director of the program on political reform at New America.

The Big Idea is Vox’s home for smart discussion of the most important issues and ideas in politics, science, and culture — typically by outside contributors. If you have an idea for a piece, pitch us at thebigidea@vox.com.