A judge on Friday approved Detroit's plan to get out of bankruptcy, ending the largest public filing in U.S. history and launching the city into a turnaround that will require discipline after years of corruption, budget-busting debt and an exodus of residents.

Judge Steven Rhodes announced his decision from the bench.

"The court confirms the plan," Rhodes said within seconds of entering court. He urged the audience to be prepared for a long explanation.

Detroit is cutting the pensions of general retirees by 4.5 percent, erasing $7 billion of debt and promising to spend $1.7 billion to demolish scores of dead buildings, improve public safety and upgrade basic services, among other key steps.

The case concluded in just under 16 months, lightning speed by bankruptcy standards. The success was largely due to a series of deals between Detroit and major creditors, especially retirees who agreed to accept smaller pension checks after the judge said they had no protection under the Michigan Constitution.

No significant critics were left by early October. Bond insurers with more than $1 billion at stake repeatedly argued for the sale of valuable art but dropped that plea and settled for much less.

It took more than two years for a smaller city, Stockton, California, to get out of bankruptcy. San Bernardino, a California city even smaller than Stockton, still is operating under Chapter 9 protection more than two years after filing.

Rhodes had to accept Detroit's remedy or reject it in full, not pick pieces. His appointed expert, Martha "Marti" Kopacz of Boston, said it was "skinny" but "feasible," and she linked any future success to the skills of Mayor Mike Duggan and the city council and a badly needed overhaul of technology at city hall.

The most unusual feature of the plan is an $816 million pot of money funded by the state, foundations, philanthropists and The Detroit Institute of Arts. The money will patch holes in Detroit's pension funds, prevent even deeper cuts to retirees and avert the sale of city-owned art at the world-class museum.

Michigan Gov. Rick Snyder appointed Kevyn Orr as emergency manager in March 2013, giving him extraordinary authority to fix the city's finances.

With more square miles than Manhattan, Boston and San Francisco combined, Detroit didn't have enough tax revenue to reliably cover pensions, retiree health insurance and buckets of debt sold to keep the budget afloat.

The city has a population of 688,000, down nearly 30 percent from 2000 and an even longer descent from 1.2 million in 1980.

Duggan, in office less than a year, is the fourth mayor since 2008 when Kwame Kilpatrick resigned in scandal. A dreadful debt deal under Kilpatrick that locked Detroit into a high interest rate when rates were falling during the recession contributed to the bankruptcy.