For years, experts warned the federal government that a disaster was brewing, yet elected officials of both parties took no action.

And so here we are, scrambling to prevent a possible national tragedy, having squandered precious time that could have been spent preparing for the inevitable.

All of the above refers, of course, to the financial crisis engulfing that venerable, and vital, institution known as the U.S. Postal Service.

The USPS faces $22 billion in expected new losses over the next 18 months, on top of the sea of red ink that was already forecast, according to a recent statement by Megan Brennan, the postmaster general and chief executive of the USPS. Insolvency cannot be ruled out.

Obviously, the Postal Service cash hemorrhage stems from the wider economic shutdown caused by the novel coronavirus pandemic and the measures government and business took to counter it.

Still, the USPS could have reached this perilous moment in much better financial shape if Congress had heeded repeated warnings that it faced deep structural problems, stemming fundamentally from technological obsolescence in an age of text messaging and email.

To cite one of many such analyses, the Government Accountability Office (GAO) reported in April 2010 that the “USPS’s business model is not viable due to USPS’s inability to reduce costs sufficiently in response to continuing mail volume and revenue declines.”

The volume of first-class mail, the USPS’s bread-and-butter product, has plunged from its all-time high of 103.5 billion pieces in 2000 to 54.9 billion pieces in 2019, a 47 percent decrease at a time when the population grew 16 percent.

Consequently, the service amassed more than $77 billion in losses over the past 12 years, according to subsequent GAO analysis. Its unfunded liabilities, mainly pensions and health-care benefits for its unionized workforce, amount to more than twice its annual revenue, which was $71.1 billion in fiscal 2019.

“Urgent” change was needed, the GAO said in 2010, to right-size a far-flung network of post offices and other USPS installations, and to reduce labor costs that accounted for 80 percent of spending.

Among expert recommendations over the years: ending mandatory Saturday delivery, relaxing regulations that subject products that account for 76 percent of USPS revenue to rate caps and shifting retiree health costs to Medicare.

Nothing fundamental was done, despite repeated legislative efforts, because Congress refused to act. Congress balked because beneficiaries of the status quo — subsidized commercial mailers, rural congressional districts and postal unions — resisted structural change.

These “stakeholders” succeeded in part by diverting attention to the annual multibillion-dollar payments the USPS must make to cover future retiree benefits, per an obligation Congress imposed in 2006.

Undoubtedly the USPS’s cash flow would have been easier in recent years without this law, as the lobbies protested, but the underlying problem, declining first-class mail, remained. And, in any case, the Postal Service had skipped $48.2 billion worth of the required payments through fiscal 2018, according to the GAO.

The other big distraction is more recent: President Trump’s accusation that Amazon, as he put it in one tweet, is “costing the United States Post Office massive amounts of money for being their Delivery Boy.” Not coincidentally, the founder and chief executive of Amazon is Jeff Bezos, who owns The Post, whose coverage often annoys the president.

As it happens, package delivery — for Amazon and other shippers — has been one of the few growth areas for the Postal Service in recent years, and there is great debate among specialists as to whether the USPS, desperate for cash and facing stiff competition for the business, optimizes revenue from it or not.

What is not debatable is that package delivery revenue is not the decisive factor in the USPS’s predicament. Even if it had somehow made $3 billion more from package delivery than it actually did in 2019, it still would have booked an operating loss of $418 million.

Now, the coronavirus crisis is upon us and the Postal Service is pleading for tens of billions of dollars in aid.

Trump refused a Democratic plan to add a $13 billion grant, plus $11 billion in forgiveness of USPS debt, to the Cares Act, consenting only to a $10 billion line of credit, instead.

Some aid is clearly warranted: The “universal service” function the USPS uniquely provides is indeed a valuable one, even if not as vital as in the pre-Internet age. We cannot let it collapse in the middle of a crisis.

Yet the agency cannot survive over the long term without the structural change that has been postponed for too long.

Like sudden catastrophes before it, this pandemic has revealed which institutions in our society have been working well, and which have not. Tragically, the Postal Service and the congresses that were supposed to oversee it belong to the latter category.

Read more: