Mediation in the bankruptcy case was private, with participants bound to court-ordered confidentiality rules, but new details give a glimpse at how the bargain came together despite early uncertainty from foundations, headwinds in the state’s Legislature, and vehement objections from some financial creditors who initially argued that the deal was unfair and improper.

The significance of the deal became clear on Friday as Judge Steven W. Rhodes of the United States Bankruptcy Court for the Eastern District of Michigan accepted Detroit’s plan to leave bankruptcy after less than 16 months, allowing the city to shed $7 billion in debt and to invest about $1.7 billion into long-neglected services and repairs.

To reach this moment, retired general municipal workers had to agree to 4.5 percent cuts to their monthly pension checks, an end to cost-of-living increases, higher health care costs and a mandatory forfeiture of previous payments from the pension system that were deemed improper. Retired police officers and firefighters accepted smaller reductions. And, in an exit plan that was more a stack of negotiated and interconnected settlements than a court-ordered antidote, other creditors agreed to accept pennies on the dollar for their loans to the city.

But at the base of all those settlements was the grand bargain, which, in addition to preserving the museum’s vaunted collection, allowed Detroit to grant all of its retirees a better deal than first expected. The arrangement moves the art collection into a private trust that is bankruptcy-proof, while the money from foundations, museum donors and the state goes to the pension plans over the next two decades.

“This is really different,” said Joel L. Fleishman, a professor of law and public policy at Duke University and an expert on nonprofit groups. “In terms of foundation giving, there is nothing comparable to the scale or purpose of this. There are plenty of examples to point to of foundations getting together on an issue, but I don’t know of a single example of an effort to come in and save a city from bankruptcy.”