Two mid-sized California cities, Irvine and Stockton, have topped a national list of financially healthy governments compiled by an influential watchdog group. Irvine’s top ranking shouldn’t surprise anyone, given that the affluent Orange County city has long been a model for prudence, despite some high-profile spending miscues over the years. But the second-place ranking for the formally bankrupt and chronically mismanaged Stockton is an eye-opener.

Is the poor San Joaquin Valley city really a model for the nation?

“Unlike most cities, Stockton’s elected officials have only promised the amount of benefits they can afford to pay,” according to a report from Chicago-based Truth In Accounting. “Because of this, Stockton has enough money to pay all of its bills.” The group finds that after bills are paid, the city has an impressive surplus of $3,000 for each taxpayer.

This is noteworthy, but something requiring a more skeptical take. If a city overspends its income for decades and then finds itself unable to pay its bills, it can declare bankruptcy, stiff its creditors, slash health benefits for public employees and impose a new “public safety” sales tax and a library/parks tax on city residents. After starting fresh, so to speak, it can be on the way to fiscal health.

Indeed, the report notes that Stockton is in a far better financial position “since a judge ruled the city was eligible for Chapter 9 bankruptcy protection in 2013” as a way to get out from under its “staggering debt burden.” The good news is the city now has plenty of assets to pay its bills and is enjoying the fruits of a recovering economy. The bad news is Stockton still has $390 million in unfunded pension liabilities.

It’s also far from certain that city officials, led by a progressive mayor who has been touting a “universal basic income” plan (that’s privately funded, for now), has the discipline necessary to keep tight control on its spending. Stockton previously embraced a variety of profligate policiesthat brought it to federal bankruptcy court. Can it control itself in the future?

The city had lavished generous pensions on its employees and embraced what one councilmember called a “Lamborghini” healthcare plan that provided lifetime medical benefits after a relatively short period of work. The city also provided public subsidies for a variety of downtown projects. Meanwhile, the aging city’s infrastructure was – and still is – crumbling. Stockton residents used to joke that one should never call the police unless there was blood in the streets, given cutbacks in safety spending. The city’s inadequate public services are widely known.

Nevertheless, the city now is in a solid financial position. Truth in Accounting’s Director of Research Bill Bergman told me that the bankruptcy enabled Stockton to clear the decks – and it shows that municipal bankruptcy is “not necessarily bad for you.” That’s true even though it was most definitely bad for the creditors who took a haircut.

At the time of its crisis, Stockton, with a population of around 300,000 people, was the nation’s most populous city to head for bankruptcy court. Shortly thereafter, 700,000-population Detroit, Mich., gained top honors when it filed Chapter 9 in July 2013. The Stockton bankruptcy proceedings were closely watched nationwide, because the largest state pension fund in the nation, the California Public Employees’ Retirement System (CalPERS) had argued that cities could not abrogate their pension obligations even if they became insolvent.

In the end, federal Judge Christopher Klein wrote that “CalPERS has bullied its way about in this case with an iron fist insisting that it and the municipal pensions it services are inviolable. The bully may have an iron fist, but it also turns out to have a glass jaw.” He ruled that pensions could indeed be reduced if a city declares bankruptcy, but nevertheless approved Stockton tax-raising work-out plan that did not reduce pensions because the city showed that it could pay its bills going forward.

The latest report confirms that Stockton is now solvent, although critics note that the city was able to get its fiscal house in order with tax hikes and thanks to an improving economy. Some complain that the city hasn’t provided the number of new police officers that it had promised under one of its tax measures, but has saved the money instead. That has helped assure that it can pay its bills, but not that it can provide a good level of service.

For instance, the report doesn’t look at what’s known as “crowd out.”That’s the common phenomenon where cities have enough cash to stay solvent – but not enough to provide an adequate level of public services as pension costs crowd out other forms of spending. “We have much higher taxes and much lower service levels than before the bankruptcy,” said former Assemblyman Dean Andal, a Republican from Stockton. “We get to pay more for less and the tax revenue goes to pensions.” He questioned the purpose of a city. Is it to pay for retired public employees or to provide services to the citizenry?

Stockton’s fiscal crisis came to a head, whereas many other cities’ similar problems did not, because of the housing crash around 2008. The crash sent shockwaves throughout the country, but it was particularly severe in California’s Central Valley. Stockton is located in an agricultural region 80 miles northeast of San Jose, the heart of the booming Silicon Valley. As home values in the Bay Area soared, people flocked over the Altamont Pass. New subdivisions flourished. Home values increased dramatically throughout the Stockton area. After the crash, prices plummeted there by 60 percent and more. Stockton’s streets were lined with foreclosures.

But, as the report indicated, the Stockton economy is booming again. Home prices are up again and neighborhoods are fixing up. People are moving to the area, especially from the Bay Area. So many people commute from the Stockton area to parts of the Bay Area that San Joaquin County now is considered by the Census Bureau to be part of the Bay Area. That’s not necessarily a problem, but it is a warning to Stockton officials of the importance of keeping spending in line given that an economic slump always is a possibility.

The Truth In Accounting report does offer some sobering news – and some useful warnings – for municipalities across the country. Note that Irvine and Stockton, though topping the list for fiscal health, only received a “B” ranking. The group looked at a total of 75 cities, but found that 64 of them “did not have enough money to pay all of their bills. This means that to balance the budget, elected officials have not included the true costs of the government in their budget calculations and have pushed costs onto future taxpayers.” Forty-one of those cities received a “D” or “F” grade and only nine others received the middling “C” grade.

Furthermore, the report from earlier this year found that U.S. cities in general don’t have enough money to pay all of their bills, leading to an astounding $335 billion in combined unfunded liabilities for pensions, healthcare and other promises. And there’s a disturbing deficit of public information, also. “The lack of accuracy and transparency in government accounting prevents even an experienced user of government financial documents from understanding and evaluating a public-sector entity’s financial health,” the report explained.

So Stockton’s fiscal recovery is encouraging, but the path it took to get there is problematic. Let’s hope more cities learn the right lessons about spending, especially on long-term benefits for public employees and on the importance of fiscal transparency. They can do all the wrong things, end up in bankruptcy court and start with a fresh slate – or they can try to get control of their costs without all that drama.

Featured Publications