(Mark Wilson/GETTY IMAGES)

HERE ARE the facts of life about the American public sector: Citizens depend on local government for vital services, from education to parks; the quantity and quality of those services depend directly on how many tax dollars are available to pay for them; and insofar as those resources are already committed to pensions and other forms of deferred compensation for public employees, they can’t be used to maintain and enhance services in the here and now.

Of course, there’s a balance to be struck. Attracting quality personnel depends to some extent on compensation, current and deferred, and governments should compensate fairly even if that weren’t the case. Yet in many jurisdictions the balance has tipped too far in favor of ­public-employee benefits, largely because neither public-sector unions nor the politicians whose campaigns the unions support have any incentive to budget more realistically. Unsustainable pensions helped cause the recent wave of municipal bankruptcies that has touched cities as different as Detroit and Vallejo, Calif.

Fortunately, courts tasked with sorting out the affairs of these troubled cities are making decisions that may help others avoid their fate. A federal bankruptcy judge in Michigan ruled last year that Detroit’s public-employee pensions were not, as unions contended, immune to the treatment other creditors receive in municipal bankruptcy — i.e., pension commitments, too, could be reduced for the sake of giving the city a fresh financial start. Workers had to join in the “grand bargain” and share the pain of Detroit’s workout along with other responsible parties. This was hardly a happy outcome, but it reinforces the point that governments should make realistic budgets now so that public workers elsewhere don’t face similar unanticipated sacrifices.

Now another federal judge, Christopher Klein in California, has similarly ruled that the California Public Employees’ Retirement System (Cal­pers) lacks the authority to threaten the bankrupt city of Stockton with more than a billion dollars in “termination fees” if it fails to pay its pension obligations in full. Calpers insisted on that position even though it meant Stockton would have to stiff other creditors. Judge Klein said that Cal­pers’s claim, which was based on a state law, “is simply invalid in face of the U.S. Constitution.” What he meant was that the Constitution provides for the supremacy of federal law, which includes the bankruptcy code. And the bankruptcy code authorizes bankrupt cities to reduce their pension obligations along with other debts.

Stockton had sided with Calpers in the case, which was not surprising, given the pension fund’s threat; Judge Klein’s ruling came in response to a lawsuit by another of the city’s creditors. Yet in the long run the decision should benefit Stockton and other towns. In addition to the Detroit ruling, Judge Klein’s decision strengthens the precedential weight behind the proposition that public-employee pensions are not sacrosanct in municipal bankruptcy. With that proposition embedded in the law, both politicians and the unions that negotiate with them face stronger incentives to strike sustainable pension deals in the first place — rather than shift all the risk to future retirees, as they have too often done in the past.