Stockton, California, can stay in bankruptcy after a judge said he found that the biggest U.S. city in bankruptcy negotiated in good faith with its creditors, and that the creditors didn’t.

Creditors, including Assured Guaranty Corp. and Franklin Resources Inc. had argued that Stockton didn’t qualify for bankruptcy because the city isn’t truly insolvent, and that its leaders didn’t negotiate a potential settlement in good faith.

Negotiation is a “two way street,” said U.S. Bankruptcy Judge Christopher M. Klein in Sacramento, addressing creditors who he said didn’t negotiate in good faith. “You cannot negotiate with a stone wall.”

In the course of the hearing today, Klein has also said that the city’s witnesses were credible and that the city was “by any measure” insolvent when it filed for protection from creditors.

The city of 296,000, an agricultural center about 80 miles (130 kilometers) east of San Francisco, is among three municipalities that have said they’ll try to force creditors, including bondholders, to take less than the principal they are owed. The other two are San Bernardino, California, and Jefferson County, Alabama. No city or county since at least the 1930s has used the power of a U.S. bankruptcy court to force a reduction in its debt principal.

Without bankruptcy court protection, Stockton’s creditors would be free to sue the city in state court, where it’s easier to force asset sales, cuts in city services or a boost in revenue to pay debt. While in bankruptcy, Stockton is shielded from such tactics and has more power to choose which bills to pay.

Before filing for bankruptcy in June under Chapter 9 of the U.S. Bankruptcy Code, the city asked bondholders and other lenders owed more than $300 million to take less than full repayment. The city listed assets of more than $1 billion and debt of more than $500 million in its bankruptcy petition.

Stockton joined cities across the U.S. using the federal bankruptcy code to get out from under billions of dollars in obligations they couldn’t afford following the longest recession since the 1930s. Stockton rode a surge in new-home construction in the 2000s that preceded the housing crash and a wave of foreclosures that sapped the city’s tax-revenue gains.

Creditors claimed that the city failed to meet at least one of three primary tests specified in Chapter 9 or California law. Before turning to bankruptcy, a city must be insolvent, have permission from its state government, and have tried in “good faith” to negotiate a deal with creditors.

Assured, based in Hamilton, Bermuda, argued in court papers that the city, in an effort to become insolvent, manipulated its budget process by refusing to raise taxes and limiting service cuts.