The day the debt-ridden Texas oil producer MDC Energy filed for bankruptcy eight months ago, a tank at one of its wells was furiously leaking methane, a potent greenhouse gas, into the atmosphere. As of last week, dangerous, invisible gases were still spewing into the air. By one estimate, the company would need more than $40 million to clean up its wells if they were permanently closed. But the debts of MDC’s parent company now exceed the value of its assets by more than $180 million.

In the months before its bankruptcy filing, though, the company managed to pay its chief executive $8.5 million in consulting fees, its top lender, the French investment bank Natixis, later alleged in bankruptcy court.

Oil and gas companies in the United States are hurtling toward bankruptcy at a pace not seen in years, driven under by a global price war and a pandemic that has slashed demand. And in the wake of this economic carnage is a potential environmental disaster — unprofitable wells that will be abandoned or left untended, even as they continue leaking planet-warming pollutants, and a costly bill for taxpayers to clean it all up.  Still, as these businesses collapse, millions of dollars have flowed to executive compensation.

Whiting Petroleum, a major shale driller in North Dakota that sought bankruptcy protection in April, approved almost $15 million in cash bonuses for its top executives six days before its bankruptcy filing. Chesapeake Energy, a shale pioneer, declared bankruptcy last month, just weeks after it paid $25 million in bonuses to a group of executives. And Diamond Offshore Drilling secured a $9.7 million tax refund under the Covid-19 stimulus bill Congress passed in March, before filing to reorganize in bankruptcy court the next month. Then it won approval from a bankruptcy judge to pay its executives the same amount, as cash incentives.