BOISE, Idaho — A federal judge has cancelled more than $125 million in oil and gas leases on public lands that are home to the declining bird species greater sage grouse, in a ruling that said the Trump administration illegally curtailed public comment.

The ruling doesn’t stop drilling already underway in areas with sage grouse, but it could help protect the birds from future activity.

U.S. Magistrate Judge Ronald Bush’s ruling out of Boise, Idaho, covers leases issued by the federal Bureau of Land Management in 2018 on more than 1,300 square miles (3,400 square kilometers) in Nevada, Utah and Wyoming,

The case is part of a broader effort by environmentalists challenging the administration’s oil and gas leasing practices within the habitat of the ground-dwelling greater sage grouse.

The birds that range across 11 Western states have suffered sharp population declines in recent decades due to development, disease, drought and wildfires.

Future leases in greater sage-grouse habitat must allow a 30-day public comment and administrative protest period, Bush ordered. The Trump administration had reduced the protest period to just 10 days, which critics said gave them too little time to meaningfully react to proposed sales.

The ruling means any future sales on more than 100,000 square miles (270,000 square kilometers) of sage grouse habitat also would require the longer public comment period, according to Talasi Brooks with the Western Watersheds Project, one of the groups that challenged the lease sales with a federal lawsuit.

“It’s a real win for public process and transparency in federal decision making,” Brooks said. “It could change the outcome potentially. The government could say after hearing public comment, ‘This is potentially important habitat.’”

The state of Wyoming, the oil industry and the federal government had argued against cancelling the leases outright because of the huge amount of money at stake. They wanted Bush to merely suspend them or say that no drilling could occur pending more public comment.

Cancelling the leases “would require BLM (Bureau of Land Management) to refund over $125 million worth of revenues to the purchasers,” attorneys for Wyoming and the Western Energy Alliance said in a joint court filing. “This represents a massive disruptive consequence to the federal government, the affected state governments, and the lessees.”

Bush said he had considered the “undeniably significant” economic impacts of voiding the lease sales. But judge said allowing the leases to stand would provide incentive for the government to approve potentially illegal projects out of the hope that they would be “too massive to unwind.”

BLM spokesman Derrick Henry said in response to the ruling that the agency supports “common-sense adjustments” to rules that govern leasing as a way to get rid of “burdensome regulations.”

A U.S. Justice Department spokesman said the government was reviewing the ruling and declined to say if an appeal was planned.

Under former President Barack Obama, the Interior Department delayed many lease sales for years because of sage grouse worries. In 2015, it adopted a set of wide-ranging plans meant to protect the best grouse habitat and keep the bird off the endangered species list.

Under Trump, the agency has placed a greater priority on energy development, including directives that rolled back or eased restrictions imposed by the Obama administration.