Updated

After ignoring the requirement for decades, the Environmental Protection Agency is now under court order to quickly evaluate how many power plant and coal mining jobs are being lost due to air pollution regulations.

U.S. District Judge John Preston Bailey in West Virginia made the ruling Wednesday after reviewing a response from outgoing EPA Administrator Gina McCarthy.

The judge had objected to McCarthy’s response to an earlier order, in a lawsuit by Murray Energy Corp., that the EPA must start conducting the analysis. According to Wednesday's order, McCarthy asserted it would take the agency up to two years to devise a methodology to use to try to comply.

"This response is wholly insufficient, unacceptable, and unnecessary," Bailey wrote.

The judge said the EPA is required by law to analyze the economic impact on a continuing basis when enforcing the Clean Air Act and McCarthy's response "evidences the continued hostility on the part of the EPA to acceptance of the mission established by Congress."

Bailey ordered the EPA to identify facilities harmed by the regulations during the Obama presidency by July 1. That includes identifying facilities at risk of closure or reductions in employment.

The EPA had contended that analyzing job loss won't change global energy trends.

The judge also set a Dec. 31 deadline for the EPA to provide documentation on how it is continuously evaluating the loss and shifts in employment that may result from administration and enforcement of the Clean Air Act.

The EPA said it was reviewing the ruling, first reported by the Wheeling Intelligencer and News-Register.

Murray Energy and other coal companies have blamed thousands of layoffs this decade on President Obama's anti-global-warming push that imposes limits on carbon pollution from coal-fired power plants. The U.S. Supreme Court has delayed implementation of Obama's Clean Power Plan until legal challenges are resolved.

West Virginia's economy is reliant on coal mining and gets 96 percent of its electricity from coal-fired plants.

McCarthy has said no administration has interpreted federal law to require job impact analysis for rulemaking since 1977. She said the most that the EPA does is "conduct proactive analysis of the employment effects of our rulemaking actions," but that has not included investigating power plant and mine closures and worker dislocations on an ongoing basis, according to the order.

Bailey wrote that the EPA can recommend amendments to Congress if it feels strongly enough.

"EPA does not get to decide whether compliance with (the law) is good policy, or would lead to too many difficulties for the agency," Bailey wrote. "It is time for the EPA to recognize that Congress makes the law, and EPA must not only enforce the law, it must obey it."

President-elect Donald Trump, who has selected Oklahoma Attorney General Scott Pruitt to head the EPA, has promised to overturn many of the EPA's regulations on coal.

Pruitt has repeatedly sued the EPA since becoming Oklahoma's attorney general in 2011.

The Associated Press contributed to this report.