FLAGSTAFF, Ariz. — A tree-cutting ban in Southwest forests meant to protect a threatened spotted owl was narrowed Tuesday to exclude personal firewood cutting permits that residents in rural areas rely on to heat their homes and cook.

The ban on timber management activities covers 18,750 square miles (48,600 sq. kilometers) in all five national forests in New Mexico and the Tonto National Forest outside Phoenix.

A U.S. judge amended it to allow the sale and use of personal firewood cutting and gathering permits after an environmental group said such permits wouldn't irreparably harm the Mexican spotted owl.

The U.S. Forest Service said permit sales resumed immediately.

"A lot of people would have had a terrible winter without the firewood permits," said Roy Adair, a retired auto mechanic in Roswell, New Mexico, who needs 10 cords of wood for his family.

Forest thinning projects, prescribed burns and commercial wood cutting still are banned.

Wood is the primary heating source for many residents who cannot afford propane and don't have access to natural gas. The thought of having to endure the winter without it caused some to panic and worry about the well-being of their neighbors.

Adair had planned to comb through scrap wood piles at the landfill or chop up tree stumps around his yard to throw in the stove if he couldn't gather firewood in the national forest.

"We want to be completely self-sustainable but every time we get where we need to be, something like this happens," he said. "I don't have $500 to $600 to go out and (buy) firewood."

New Mexico's congressional delegation and state lawmakers wrote to federal officials, saying thousands of people would be affected if the broader ban remained in place. New Mexico Gov. Michelle Lujan Grisham said Tuesday she's grateful for the court's quick action to avoid "what would have been a devastating situation."

The Forest Service had more than 8,200 active permits for personal firewood cutting on file when the ban took effect.

The court order issued Sept. 11 stems from a 2013 lawsuit in which WildEarth Guardians accused the federal government of failing to consider the impact of widespread thinning and logging on the owls and their habitat.

The environmental group said the U.S. Fish and Wildlife Service and the Forest Service have failed to track the bird's numbers.

U.S. District Judge Raner Collins in Arizona agreed and sidelined timber management activities until the federal agencies come up with a way to count the owls as part of a recovery plan.

WildEarth Guardians also asked Collins to order the parties into mediation to further define the ban. The judge gave the federal agencies a week to respond.

John Horning of WildEarth Guardians said the group wants clarification on trail maintenance, medicinal plant gathering, tribal ceremonial activities and prescribed burns.

Forest Service spokesman Shayne Martin said the agency also wants to discuss prescribed burns meant to reduce the risk of catastrophic wildfires and safety issues like removing trees from power lines or above roads.

About two dozen projects including prescribed burns, thinning and other forest restoration work are on hold.

First listed as threatened in the U.S. in 1993, the Mexican spotted owl is found in Arizona, New Mexico, Colorado, Utah, parts of west Texas and Mexico but not uniformly. The tree-cutting ban doesn't extend beyond New Mexico and Arizona.