Stockton, Calif., will become the largest U.S. city to file for bankruptcy, which could happen as early as Wednesday, after talks with bondholders and labor unions failed.

The city is fiscally insolvent and must seek chapter 9 bankruptcy protection, Stockton said in a statement released Tuesday night after its council voted 6-1 in favor of a spending plan that operates under bankruptcy protection.

The working-class port city lived largely on credit during economic boom times, before the housing bubble burst in 2007. Between 2000 and 2006, home prices rose from a median of slightly more than $110,000 to almost $400,000, according to How Stockton Went Bust, an analysis prepared by California Common Sense (CCS), a nonpartisan, nonprofit group advocating financial transparency.

The city borrowed millions on projects that officials hoped would rehabilitate and beautify its downtown -- such as a $129 million waterfront project, a $68 million arena for minor league hockey and a $35 million city hall that has since been repossessed, according to the Wall Street Journal.

Stockton, which has a population of about 300,000, was also generous with city employees. The generous salaries and pensions to which the city became committed in the mid-2000s, according to the CCS report, now comprise the bulk of the city's budget. The city now faces more than $800 million in unfunded liabilities for pensions and other retirement benefits, the report notes.

When the bust came, few places were hit as hard as Stockton. According to RealtyTrac Inc., one in every 195 homes in Stockton's metropolitan area received a foreclosure filing in May, the fifth-highest rate in the U.S.

In the past three years, officials in Stockton have addressed about $90 million in deficits, by eliminating a quarter of its police officers, one-third of its firefighters and 43 percent of general city staff. They also cut wages and medical benefits.

In April, the unemployment rate in Stockton stood at a stunning 15.4 percent, almost double the national average, as the city continued to cut services to reduce costs. City officials said in a June 5 fiscal report that public safety is at a crisis level.

To plug next year's anticipated $26 million budget shortfall, the budget for the fiscal year beginning July 1 will default on $10.2 million in debt payments, cut $11.2 million in employee pay and benefits under union contracts and increase revenue through code enforcement and parking citations.

According to city manager Bob Deis, bankruptcy is the only way to preserve a minimal level of services and public order. Stockton has the second-highest rate of foreclosures in the country, the second-highest rate of violent crime rate in the state. It has twice topped Forbes magazine's list of America's most miserable cities.

The whole purpose of filing Chapter 9 is to avoid an uncontrolled chaotic situation, Deis said. Bankruptcy provides the equivalent of a pause button. It retains services and provides structure so you don't have a bunch of lawsuits.

Stockton has already defaulted on about $2 million in debt since February, which prompted Moody's Investors Service and Standard & Poor's Ratings Services to slash their credit ratings on Stockton. Moody's has cut its issuer rating for Stockton to a junk level Ba2 from Baa1, while S&P has cut its issuer rating on the city from BB to SD, just one notch above its D default rating.

The city's painful step follows last year's bankruptcy filing by Alabama's Jefferson County, which set the record for the biggest municipal bankruptcy filing last November with more than $4 billion in debt.

Municipal bankruptcies in the U.S. became more common after the 2008 financial crisis hit. Ten of 42 cases filed since 1981 came in the past four years, Bloomberg reports, citing court records.