GILLETTE, Wyo. (AP) — A federal bankruptcy judge in West Virginia on Wednesday approved a new plan to sell two of the biggest coal mines in the U.S.

Under the deal, West Virginia-based Blackjewel would sell the Eagle Butte and Belle Ayr mines in northeast Wyoming to Eagle Specialty Materials, a subsidiary of Alabama-based FM Coal.

Blackjewel halted almost all Wyoming operations and furloughed some 600 employees in the state when it filed for bankruptcy July 1. The sale could allow the mines to reopen.

About 500 employees who haven’t taken other jobs could go back to work, Blackjewel attorney Stephen Lerner told Judge Frank W. Volk.

The court in August approved the mines’ sale to Tennessee-based Contura Energy, a former owner and ongoing Wyoming permit-holder. The deal didn’t go through, however, as government officials seeking to collect federal coal royalties withheld approval.

Under the new deal, which also would require federal approval, Contura would pay Eagle $90 million. Eagle would assume $237 million in reclamation liabilities and certain Blackjewel debts.

Eagle Specialty Materials would mine as a contractor for Contura until it could secure transfers of state and federal permits and leases in its name, the Gillette News-Record reported.

Eagle Butte and Belle Ayr were the fourth- and sixth-most productive U.S. coal mines in 2017, according to the U.S. Energy Information Administration.