The $1.4 trillion spending bill passed by Congress last week quietly achieves what a parade of select committees and coordinating councils could not: the rescue of a dying pension fund that is the lifeblood of nearly 100,000 retired coal miners.

For the first time in 45 years of federal pension law, taxpayer dollars will be used to bail out a fund for workers in the private sector. And now that there’s a precedent, it might not be the last.

“We could be the blueprint,” said Chuck Pettit, who mined coal for 42 years. “But we’ve got to do it right.”

The coal miners belong to one of about 1,400 pension plans that cover a large group of workers in a single industry or trade. These so-called multiemployer plans cover more than 10 million workers in unions including the Teamsters, the American Federation of Musicians, the Screen Actors Guild and, in Pettit’s case, the United Mine Workers of America. Even President Donald Trump has a multi­employer pension, worth about $70,000 a year, earned in his reality-TV days.

But nearly three-quarters of the people with this type of pension are in plans that have less than half the money they need to pay promised benefits, according to the Pension Benefit Guaranty Corp., the federal agency that insures pension plans. Chronic underfunding, lax government oversight and serial bankruptcies have left them in dire straits. And the guaranty corporation’s program backing up these plans — which operated under the assumption that they were inherently strong — would be wiped out by the failure of just one of the major pension pools.

“It’s a disaster waiting to happen,” said James Naughton, an associate professor at the University of Virginia’s Darden School of Business and an actuary whose clients have included multiemployer pension plans.

The solution approved by Congress uses the Abandoned Mine Lands Reclamation Fund, which is partly supported by a per-ton fee that all coal companies pay. In 1992, Congress allowed the fund to help pay for retired miners’ health care, and the new legislation — the Bipartisan American Miners Act — uses the fund as a vehicle to support the pensions, too. The bill, among other changes, allows the Treasury to send as much as $750 million a year into the fund as it covers the unfunded pension obligations.

A failure to act would have had dire consequences: Tens of thousands of miners, many in already economically distressed areas, would have lost their benefits. And coal pensions support not just families but sometimes whole towns.

The collapse of the miners’ plan was hastened by the parade of bankruptcies that have hit the industry in recent years. By this fall, just one major employer, Murray Energy, was still paying into the fund. On Oct. 29, Murray declared bankruptcy — the eighth coal producer to do so this year.

Usually, leaving a multiemployer pension plan is an expensive proposition for a company. It must pay off its share of any shortfall to leave. But bankruptcy provides a cheap exit ramp, because the pension plan is treated as an unsecured creditor — the kind that goes to the back when everyone lines up to be paid.

After Alpha Natural Resources declared bankruptcy in 2015, for example, the pension fund’s trustees calculated that it owed $985 million. Alpha got out for about $75 million: a $10 million payment spread over four years and the rest in stock in the new company.

But when companies get out of the pension pool, their employees stay in — and become the responsibility of the companies still kicking in money. As more companies failed, it only increased the pressure on the others to get out. The result has been a complicated cascade of splits, sales and financial collapses.

Pettit, 70, started his career at the Consolidated Coal Co. and stayed with it until he retired in 2011. He spent more than four decades at the vast Shoemaker Mine, just south of Wheeling, W.Va.

When he started there, Consolidated was one of more than 180 employers paying into the pool, he said. Times were good: He could work plenty of overtime, put his two children through college and accrue retirement benefits that would provide for his wife if he died.

“That’s the reason we fight so hard,” he said. “A good friend of mine got killed in the mine, and his wife is still taken care of.”

By the time he retired, he said, just 11 companies were paying into the pension fund. His former employer — by then known as Consol — sent the most, $35 million. But two years later, Consol announced that it wanted to diversify into natural gas and was selling the Shoemaker Mine and four others with union contracts. The high bid came from Murray Energy, which also took over Consol’s stake in the pension fund, until its bankruptcy.

An average coal miner’s pension is about $7,150 annually, according to Lorraine Lewis, executive director of the United Mine Workers’ Health and Retirement Funds. More recent retirees typically get more.

While the new legislation ensures that Pettit will be paid, it does nothing to address the problems of other plans.

“Every plan is in a precarious position,” said Naughton, the former actuary. “If you’re in any declining industry, your plan is in trouble. If you’re in a growing industry, your plan is OK until it starts to decline.”