An aging industrial port city 85 miles east of San Francisco, Stockton rarely makes headlines beyond northern California. But word of the city’s bankruptcy last week became national news, and commentators are struggling to explain what went wrong. One popular explanation is that the city owes its fiscal woes to simple bad luck. But Stockton’s troubles aren’t happenstance; the real culprit is its officials’ lousy decision-making.

The bad decisions are all too easy to describe. Back when times were better, Stockton embraced a combination of overly generous compensation packages for city employees and excessive debt spending—not only on pension bonds but also on bonds to pay for redevelopment projects, which were supposed to revive the downtown area. (They predictably failed, but that’s another story.) The city’s health-care plan was so generous that employees and their spouses could sometimes qualify for lifetime health care after only a short time on the job. “Stockton never set aside funds for retirees’ healthcare, so it has had no cushion as their medical costs soared,” Reuters reported recently. The city also approved the generous “3 percent at 50” retirement plan for public-safety workers—shorthand for a scheme calculating pensions at a rate of 3 percent of the average of an employee’s three highest years’ salary, multiplied by the number of years worked, starting as early as age 50. Many public-safety employees were able to retire at 50 with 90 percent of their final year’s pay.

Yet the Los Angeles Times warns against drawing the obvious conclusion in a recent editorial: “No doubt observers in other cities and states, and from various spots in the political spectrum, will be ready with pointing fingers and easy ideologically-based explanations: It was greedy public workers and their unions who brought us to this point. It was greedy Wall Street bankers and their outsize clout over municipal bonds. It was corrupt politicians, overregulation of business, the Republicans, the Democrats, conservatives, liberals, social spending, capitalism, delusions of grandeur, failures of imagination.” The Times rejects all these explanations and blames bad luck: “Stockton went bankrupt at least in part because a historic nationwide mortgage meltdown and worldwide economic implosion occurred at just the wrong time.”

Without question, the bursting of the housing bubble hit Stockton and surrounding communities especially hard. Stockton isn’t an unreasonable commute from the part of the San Francisco Bay Area known as the East Bay. During the bubble, housing prices soared in the East Bay, sending middle-income apartment dwellers to places like Stockton, where they could buy a house with little or no money down. So Stockton grew rapidly—until the bubble burst, sending home values on a terrifying plunge. But the biggest problem for Stockton and other cities (such as Mammoth Lakes, which followed Stockton into bankruptcy on Monday) wasn’t the property bubble but what they did with the revenue that poured into their treasuries when home prices were so high: signing those unaffordable employee contracts, on the ridiculous assumption that property values would only keep rising. “If only city officials had exercised a modicum of fiscal discipline,” Contra Costa Times columnist Dan Borenstein lamented.

Just imagine if Stockton’s city council hadn’t been encumbered by the restrictions of Proposition 13, which limits the government’s power to raise property taxes. Within the past year, several prominent Democrats have argued that Prop. 13 has worsened local governments’ fiscal woes. But undermining Prop. 13’s protections would have made it even easier for officials to evade fiscal responsibility. After all, Stockton was awash in funds during the boom and used them to embark on those ill-conceived development projects. The ability to hike property taxes would only have given the city more money to waste.

Some observers, mostly outsiders, have portrayed Stockton as a depressed city, not unlike dismal Detroit. In reality, Stockton boasts settled, vibrant neighborhoods, a fine private university, a bustling port, and many attractive features. Stockton does have blight, however, and it suffers from a rising crime rate, driven in part by the 20 percent cut in its police force. Cuts like that will become common in other California localities unless they can rein in their spending. In San Jose, for instance, reform-minded Democratic officials say that without substantive changes to government employees’ pensions, their city won’t be able to provide the public services that residents expect. Stockton, which squandered tax dollars on subsidized stadiums and Western European–style employee benefits, shows what happens when such warnings aren’t heeded.

Hundreds of Stockton residents have expressed sadness about their hometown’s bankruptcy. But the bankruptcy is the first step on the road to recovery. The real question is whether officials in other California cities learn anything about fiscal discipline and stop blaming unforeseen economic consequences for their own bad decisions.