A judge cleared Detroit to emerge from bankruptcy Friday, approving a turnaround plan that will require discipline after years of corruption, mismanagement and an exodus of residents brought this one-time industrial powerhouse to financial ruin.

"What happened in Detroit must never happen again," Judge Steven Rhodes said in bringing the case to a close a remarkably speedy 16 months after Detroit — the cradle of the auto industry — became the biggest city in U.S. history to file for bankruptcy.

The plan calls for cutting retiree pensions by 4.5 percent, erasing $7 billion of debt and spending $1.7 billion to demolish thousands of blighted buildings, make the city safer and improve long-neglected basic services.

In signing off on the plan, Rhodes made a fervent plea to residents who expressed sorrow and disgust about the city's woes.

"Move past your anger. Move past it and join in the work that is necessary to fix this city," he said. "Help your city leaders do that. It is your city."

The Motor City was brought down by a combination of factors, including misrule at City Hall, a long decline in the auto industry and a flight to the suburbs that caused the population to plummet to 688,000 from 1.2 million in 1980.

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

"Detroit's inability to provide adequate municipal services runs deep and has for years. It is inhumane and intolerable, and it must be fixed," the judge said.

Rhodes praised decisions that settled the most contentious issues in the bankruptcy case, including a deal to prevent the sell-off of world-class art at the Detroit Institute of Arts and a consensus that prevented pension cuts from getting even worse for thousands of retirees. He said the pension deal "borders on the miraculous," though he acknowledged the cuts could still cause severe misfortune for some.

Politicians and civic leaders, including Michigan Gov. Rick Snyder, hailed Friday's milestone. Museum leaders said it means "there are good days ahead for our city," while Detroit Regional Chamber President and CEO Sandy K. Baruah declared Detroit to be "on the cusp of a new era and primed to reinvent itself in a way many people did not think possible."

"Exiting bankruptcy so effectively and thoughtfully has wiped out decades of mismanagement and created a historic opportunity to move the city without mortgaging its future," Baruah said.

The case concluded in 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. Also, bond insurers with more than $1 billion in claims dropped their push to sell off art 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, is still operating under Chapter 9 protection more than two years after filing.

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 forestall even deeper pension cuts and also avert the sale of city-owned art at the museum — a step the judge warned "would forfeit Detroit's future."

Mayor Mike Duggan, in office less than a year, is the fourth mayor since 2008, when Kwame Kilpatrick resigned in a 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.

The Associated Press