Updated

The city of Stockton in California's crop-abundant Central Valley has the second-highest foreclosure rate in the nation and one of the highest crime and unemployment rates. It was named America's most miserable city in a national magazine -- twice.

And now, officials say this river port city of 290,000 is on the brink of insolvency and could become the nation's largest city to fall into Chapter 9 bankruptcy protection.

The City Council voted late Tuesday to use a new California law to enter mediation with its creditors. City leaders said they hoped the plan to renegotiate Stockton's debt would help it avoid bankruptcy.

Dozens of residents spoke against the move, saying they feared it would do the opposite, KRCA-TV reported.

"If they vote for mediation, it is the first step towards bankruptcy," former City Manager Dwane Milnes said. "That means 1,000 people could lose retirement benefits."

Stockton will be the first city to test the state law, Assembly Bill 506, which is less than 2 months old. It requires local government agencies to undergo mediation or hold a public hearing and declare a fiscal emergency before filing for bankruptcy.

In 2008, Vallejo became the biggest California city to file for bankruptcy, and it emerged from bankruptcy last year.

In recent years, thousands of new homes mushroomed in Stockton, part of a housing boom in suburban development that attracted buyers from the Bay area and beyond.

But when the economy crashed and the construction bubble burst, Stockton was battered by foreclosures and lost income from property taxes and other fees. Multi-year labor contracts with escalating costs added to the burden, forcing officials to make deep emergency cuts to the city payroll, including its police department.

"It's been so challenging. Since 2008, the whole market was essentially turned upside down," said Randy Thomas, a Stockton real estate broker with the Cornerstone Real Estate Group. "A lot of folks were losing their homes. A lot of people were getting evicted, and it's been tough on a lot of people."

City leaders say Stockton could soon be unable to pay its debts. The city has a $15 million deficit -- $6.6 million from the last fiscal year and $8.7 million expected for the current fiscal year, according to documents.

Forecasts also show deficits ranging from $20 million to $38 million for the fiscal year 2012-2013 and increasing in subsequent years.

Some residents are losing faith.

Marty Carlson, a waitress at Bradley's American Bistro in downtown Stockton, said business, along with her tips, has been on the decline for years. She's had enough, she said, and plans on leaving Stockton soon.

"They're (the city) not the only one going bankrupt," Carlson said. "It's time to move on. I'm ready."