CHICAGO (Reuters) - A U.S. judge formally approved Peabody Energy Corp's BTUUQ.PK plan to emerge from bankruptcy late Friday after the coal producer struck a settlement with the U.S. government over legacy environmental claims at a gold and metal mining subsidiary.

Peabody's St. Louis headquarters seen from the steps of the Thomas F. Eagleton U.S. Courthouse, where a hearing on the coal producer's plan to exit its Chapter 11 bankruptcy was held in St. Louis, Missouri, U.S., March 16, 2017. REUTERS/Tracy Rucinski

Under a last-minute deal with the U.S. Department of Justice, Peabody agreed to create a $43 million trust to manage environmental liabilities stemming from its dormant Gold Fields Mining subsidiary, according to court papers.

“This is a great day for Peabody and, more importantly, our multiple stakeholders who benefit from the many products and services we provide,” Peabody spokesman Vic Svec said on Saturday.

St. Louis-based Peabody, the world’s largest private-sector coal producer, owns mines in Australia and the United States and supplies the global market with the metallurgical coal used in steelmaking and the thermal coal used to generate electricity.

Peabody expects to exit bankruptcy in early April with about $2 billion of debt amid dramatically improved short-term prospects for its business versus a year ago, when it sought Chapter 11 protection with more than $8 billion of debt.

In the environmental settlement, the Department of Justice was negotiating on behalf of the Environmental Protection Agency, the Interior Department, five states and seven Indian tribes. The parties filed claims worth billions of dollars, which Peabody disputed but said it agreed to settle to avoid drawn-out litigation.

Peabody agreed earlier in March to cover about $1 billion in future coal mine cleanup costs with third-party bonds.

The company is financing its reorganization plan through a $1.5 billion stock sale, consisting of a $750 million rights offering available to bondholders and a $750 million private placement of preferred equity for institutional investors.

It was still in talks over a settlement with four individual investors who filed a lawsuit alleging that Peabody and other parties in the bankruptcy case violated their fiduciary duties by blocking individuals from the lucrative private stock sale.

It was unclear on Saturday whether the settlement would apply only to the four investors who filed the lawsuit or to all individual owners of the same unsecured bonds.

At least one investor, Mark Gottlieb, told Reuters he had not been included in the deal. Lawyer David Kovel, who filed the lawsuit for the four investors, declined to comment.

U.S. Bankruptcy Judge Barry Schermer, who oversaw Peabody’s bankruptcy, denied a request on Friday by a group of dissenting bondholders to stay the Chapter 11 confirmation while they prepared an appeal.