SINCE July, Judge Steven Rhodes has been considering whether the city of Detroit is eligible for protection from its creditors. On December 3rd he decided that it was. This clears the path for the largest municipal bankruptcy in American history. The city is carrying more than $18 billion in debt, and the judge remarked that he thought it should have filed for bankruptcy years ago.

The judgment is good news for Detroit, which can now plan an orderly escape from much of its debt. It is a blow, though, for the city’s more than 100,000 creditors, including pension funds and the retired. Labour unions had argued against bankruptcy, contending that the pensions of state employees were protected by the Michigan constitution. But Judge Rhodes ruled that federal bankruptcy law essentially treated pensions as contracts, and allowed those contracts to be broken. By the end of this year the city’s emergency manager, Kevyn Orr, is expected to produce a plan to sort it all out.

The judge’s ruling will reverberate far beyond the Midwest. CalPERS, the Californian giant that administers thousands of public pension plans, will find it harder to argue that bankrupt cities must meet their pension payments in full and on time. This strengthens the hand of San Bernardino, which went bust last year and owes CalPERS about $14m. It will also change the dynamic in other struggling cities. CalPERS says that the Detroit decision has no implications for California; many experts disagree. The Supreme Court may have the final say.

The broader implications for America’s $3.7 trillion municipal-bond market, which has seen nine straight months of outflows, remain unclear. Some worried that, given Detroit’s friendliness to organised labour, Judge Rhodes would rule in favour of pension-holders, which he did not; he held that neither bondholders nor pension-holders can expect to escape pain-free. Bart Mosley, co-president of Trident Municipal Research, said the ruling was broadly in line with market expectations. Its long-term results may even be positive: Detroit’s problems, says Mr Mosley, “raised everyone’s awareness that it is important to deal with these issues sooner rather than later.” The question Judge Rhodes did not address was whether general-obligation bonds are unsecured debt. However, Moody’s concludes that risks to bondholders are implicit in the ruling, laying the foundation for a haircut all round.

Many worry that Chicago is slipping down the same path to insolvency. The Windy City also has a structural deficit, unmanageable pension obligations and poor credit-worthiness. It lost 200,000 people in the decade leading up to the 2010 census. In November it was downgraded three notches by Fitch Ratings, mostly because Illinois lawmakers could not make the time to deal with the city’s debt burden.

Chicago also has more general-obligation debt per head than any of the ten largest cities except New York, and its pension funds have a shortfall of at least $20 billion. In 2014 it will face a pension payment “cliff” when it must pay $600m to the pension funds of the police and firemen. This is about one-fifth of its day-to-day operating budget.

There is little the city can do about its pensions problems alone, as its obligations to pensioners are determined by legislators in Springfield. Lawmakers there have been preoccupied with their own state pension crisis. Illinois has the worst-funded retirement system in the country and the lowest credit rating, and uses more than 20% of its operating revenue to pay pensions.

After years of reports, mandates and commissions, legislators published a draft reform bill on December 2nd. It was approved by the General Assembly the next day. This alacrity is a well-worn local tactic to catch the opposition on the hop. Although the bill will save $160 billion over 30 years, the unfunded liability of $100 billion is reduced by only 20%.

Most of the savings come from reducing cost-of-living adjustments to pensions. The retirement age will also rise, though hardly painfully; teachers in their 20s will have to wait until 60 to retire. Laurence Msall, president of the Civic Federation, an independent budget watchdog, says the bill will begin to stabilise the system. Voices on the right are more critical—among them Bruce Rauner, a wealthy businessman who is running for governor in 2014, and the Illinois Policy Institute. The deal, some warn, will put up taxes. But many business groups supported it, probably because it was the best they could hope for in Democrat-run Illinois.

The unions are furious about the changes, even though employee contributions will decline and most pensioners will still retire on 75% of final salary—remarkably generous by international standards. Unions argue that—as in Michigan—the state constitution guarantees their pensions. But as Detroit showed, pensions are not as untouchable as everyone thought. The final decision will rest with the elected judges of the Illinois Supreme Court.

As legislators were congratulating themselves, Mayor Rahm Emanuel of Chicago warned that the pension crisis in his city would not be solved until legislation was passed in Springfield to relieve it. Arlene Bohner, an analyst at Fitch, says that until recently Chicago could have coped with its debt pretty efficiently. Now, even if relief arrives soon, the situation will be “fairly painful” and involve hard decisions about raising revenues or cutting costs. As Ms Bohner points out, there is an economic vibrancy in Chicago, and a diversity in its economy, which makes it better placed than Detroit to weather the storm. But not to avoid it.