A federal court has quashed the Trump administration’s effort to relax a health and safety rule for mine workers, arguing that the changes would put miners at risk.

The Obama-era rule — finalized in 2017 in that administration's last days — requires mine operators to examine workplaces before miners begin their shifts and to make a record of adverse health and safety conditions. The rule applies to workers who extract granite, stone, copper and other noncoal substances from mines.

Under Labor Secretary Alexander Acosta, the Mine Safety and Health Administration modified the rule in 2018 by allowing mines to conduct inspections either “before work begins or as miners begin work,” and excusing them from having to record harmful conditions that are corrected quickly.

On June 11, a three-judge panel of the U.S. Court of Appeals for the District of Columbia found that the administration’s justification for relaxing the safety rule was “arbitrary and capricious." Under federal law, the MSHA is prohibited from making changes that weaken existing health and safety protections for workers.

“Because the 2018 Amendment allows miners to work in an area before the examination is completed, there is the likelihood that miners may be exposed to an adverse condition before it is discovered,” Judge Karen LeCraft Henderson wrote in the ruling, which ordered the administration to put the 2017 version of the rule into effect.

The Labor Department declined to comment.

The United Mine Workers of America, one of the labor unions that challenged the Trump administration’s changes to the inspection rule, hailed the court’s ruling as “a victory for miners everywhere” that prevents the administration from “rolling back critical safety and health standards.”

“If the agency had been allowed to get away with this, there is no question that we would soon be looking at a host of other attempts to reduce safety standards in every mine in America,” union president Cecil Roberts said in a statement.

The National Mining Association, an industry group, was not part of the case but said it was “clearly disappointed in the ruling, given our firm belief that operators require flexibility in the timing of examinations,” spokesperson Conor Bernstein said in an email.

“Flexibility is a safety best practice that accounts for the fact that changes in conditions can and do occur throughout a mining shift,” he added.

The National Mining Association was among the industry groups that sued over the original 2017 worker safety rule — a lawsuit that was temporarily halted by the U.S. Court of Appeals for the 11th Circuit when the Trump administration amended the requirements. The group said it was still deciding whether to continue that challenge.