When an oil and gas company goes bankrupt, should profits from the sale of remaining assets go first to lenders , or to pay to clean up the environmental mess left behind?

When an oil and gas company goes bankrupt, should profits from the sale of remaining assets go first to lenders , or to pay to clean up the environmental mess left behind?