Defeat of Senate Republicans’ Obamacare repeal bill spares — for now — a program that has become a primary source of funding for state efforts to prevent chronic illnesses, such as heart ailments and diabetes, and the spread of infectious diseases.

The Affordable Care Act’s Prevention and Public Health Fund was likely to be eliminated as part of Senate Republicans’ repeal strategy. Nearly all Obamacare repeal plans proposed in Congress would quash the fund, including the “skinny repeal” that lost 49-51 in the early hours Friday.

Republican lawmakers have cited it as a quintessential example of a government slush fund since Obamacare’s enactment in 2010. And with the mandatory funding stream on the chopping block in the Republican-controlled Congress, public health advocates were worried about a massive shortfall in funding for crucial public health programs in the near future.

Following the collapse of the skinny repeal, the PPHF appears safer than it did before. But the latest setback in the Senate by no means spells the end of a seven-year campaign to repeal former President Barack Obama’s signature domestic achievement. Republicans have made repealing the PPHF a top priority, citing instances in which funding has gone to questionable causes.

Public health advocates warn that eliminating the fund could cripple the nation’s ability to respond to disease outbreaks, and hamper chronic disease prevention efforts. PPHF funding provides nearly $1 billion in state grants annually.

“Over the next five years alone, states stand to lose over $3 billion in funding they rely on to prevent chronic disease, halt the spread of infections and epidemics, and invest in the community resources that support health and equity,” several advocacy groups — including the American Public Health Association, the Prevention Institute, the Public Health Institute, the Society of Public Health Education and Trust for America’s Health — said Thursday in a joint statement.

Most states wouldn’t be able to take on more of the funding burden for their public health prevention programs if the federal grants are eliminated, said Michael Fraser, executive director of the Association of State and Territorial Health Officials, a nonprofit that represents U.S. public health agencies nationwide.

“The potential elimination is really going to force health departments to make some really tough decisions,” Fraser said in a phone interview Wednesday. “Many states are facing significant budget deficits and they have to balance their budgets.”

The PPHF also makes up about 12 percent of the Centers for Disease Control and Prevention budget.

If the fund is repealed, one program that could see a big spending cut is the CDC’s Section 317 Immunization Program, which pays for vaccines and funds outbreak and surveillance efforts for infectious diseases. The program received about $600 million in funding for fiscal year 2017, with nearly $325 million of that coming from the PPHF.

“If you cut PPHF, it’s currently about half of immunization funding so that is just very scary,” Claire Hannan, executive director of the Association of Immunization Managers, said Wednesday in a phone interview. “You would have to take funding from somewhere else and I don’t know, in this environment, where you can take funding from.”

In the current fiscal year, the PPHF is also providing $126 million in anti-smoking efforts, $73 million in heart disease and stroke prevention efforts and $72 million for diabetes prevention.

If Republicans eventually succeed in undoing the ACA, Congress could fill the funding hole created by the repeal of the PPHF by appropriating more discretionary spending. Yet it is likely that the public health programs would still see a cut. There would also be more uncertainty going forward because those programs would no longer have a mandatory funding source.

Some senior Republicans have advocated against reducing funding for the CDC. Earlier this year, Rep. Tom Cole, who chairs the House Appropriations subcommittee on health, pushed back against the Trump administration’s proposed spending cuts to the CDC and the National Institutes of Health.

“These two [agencies] in particular are every bit as important for the national defense and the national security of the American people as the Pentagon is because, frankly, you’re much more likely to die in a pandemic than you are a terrorist attack,” the Oklahoma Republican said at a hearing in March.

The House Republicans’ Obamacare replacement would authorize more than $100 billion in grants to states that could then be used to address a variety of health care issues, including public health prevention. Advocates, though, believe states would be far more likely to use the funds to help prop up their individual insurance markets, and to limit out-of-pocket costs for people who would no longer be eligible for Medicaid.

“Prevention always seems to be the least of the fires you have to put out,” Hannan said.