Stockton, Calif., is expected to file for bankruptcy by the end of the week, becoming the largest U.S. city to seek protection from its creditors.

Officials said the city of nearly 300,000 could file for Chapter 9 bankruptcy by Friday afternoon, after the city council approved on Tuesday a budget that includes savings from the bankruptcy.

The $26 million budget gap that was expected for fiscal 2013 is filled half by savings from missed payments on the debt service and half by lower payments to employees, Standard & Poor's analyst Chris Morgan told Reuters.

The decision to file for bankruptcy triggered ratings cuts into default by Moody's Investors Service and Standard & Poor's Ratings Services Wednesday.

The Caa3 rating level assumes losses to bondholders will be greater than 20 percent. The negative outlook reflects the high likelihood that losses could exceed our estimates, Moody's said in its statement.

The $3.7 trillion U.S. municipal bond market has so far taken in stride Stockton's march toward bankruptcy despite the city's more than $700 million in bond debt.

Bondholders and bond insurers are among Stockton's 18 creditors. Other creditors are the 1,400 employees of the city including police officers, firefighters, non-public safety employees and their supervisors and retired city employees.

On Tuesday, Stockton's city council voted 6-1 in favor of the 2012-2013 budget after a contentious five-hour meeting during which angry retired city workers pressed council members to reject the $155 million spending plan. It proposes eliminating retirees' medical benefits.

Tuesday's meeting was tense from start to finish, and hundreds of people gathered in the council chambers and two overflow rooms, the San Francisco Chronicle reported. City retirees whose benefits would be cut clapped loudly as speaker after speaker denounced city leaders as tyrants and incompetent.

Mayor Ann Johnston ordered the crowd to be silent, in vain.

Just before calling for the vote, Johnston said, This is probably the most difficult decision I've ever had to make as a public official. It's heart-wrenching to think about the implications for all of you sitting here. But we have to do something drastic to get our budget balanced and to move forward.

The council's vote followed three months of confidential talks between Stockton and its creditors aimed at averting bankruptcy. The negotiations ended on Monday with the city failing to win enough concessions to help close its shortfall for the fiscal year starting on July 1.

That left bankruptcy as the only way for Stockton to balance its budget in the near term while maintaining its current level of services and bringing stability to its finances.

While the city has cut $90 million from the general fund over the past three years, reducing the police force by 25 percent, Fire Department by 30 percent and general city staff by 43 percent, it still wasn't enough. 

Like corporations such as American Airlines and General Motors, we will continue to operate and provide services. We will use this opportunity to restructure and come out of bankruptcy with a stronger, healthier and sustainable future, City Manager Bob Deise said.

Deise compares Stockton's strategy with that of General Motors and American Airlines, recent examples of a decades-old business technique to renege on costly retirement promises by filing for bankruptcy.

This is a big test case, University of Pennsylvania law professor David Skeel told USA Today. The conventional wisdom has been until very recently that you can't touch retirement benefits or labor contracts in bankruptcy court. That conventional wisdom has been rapidly eroding because of the horrendous financial conditions of some cities and the role pensions are playing in the trouble.

Since February, Stockton officials have said the city's finances were suffering the combined effects of fiscal mismanagement over two decades, too much debt taken on in good times and generous pay and unsustainable benefits for city employees and retirees.

Stockton has also had a sharp decline in revenue since the collapse of its once red-hot housing market. The housing boom transformed the farming city into a distant bedroom community of the San Francisco Bay area, but its bust put Stockton at or near the top of national foreclosure rankings in recent years.

Stockton has defaulted on about $2 million in debt since February, allowing the trustee for one of its bond insurers to seize a building once slated to be its future city hall and three parking garages.

Because municipal bankruptcies under Chapter 9 of the federal bankruptcy code are rare, especially for larger cities, Stockton could set important precedents for how different types of creditors are treated in such cases.

In the past, large cities such as Bridgeport, Conn., have seen filings for bankruptcy protection rejected by the court. In the most recent case in October 2011, a filing by Harrisburg, Pa., a city of nearly 50,000, was rejected because a state law barred municipalities of a certain size from seeking legal protection from creditors.