BILLINGS, Mont. (AP) — A U.S. judge ordered federal protections restored for grizzly bears in the Northern Rocky Mountains on Monday, a move that blocks the first grizzly hunts planned in the Lower 48 states in almost three decades.

Wyoming and Idaho had been on the cusp of allowing hunters to kill up to 23 bears this fall. U.S. District Judge Dana Christensen had twice delayed the hunts, and the latest order blocking them was due to expire later this week. The hunts would have been the first in U.S. outside Alaska since 1991.

Christensen wrote in his ruling that the case was "not about the ethics of hunting." Rather, he said, it was about whether federal officials adequately considered threats to the species' long-term recovery when they lifted protections for more than 700 bears living around Yellowstone National Park.

In the judge's view, the answer was no.

He noted that an estimated 50,000 bears once roamed the contiguous U.S. and said it would be "simplistic at best and disingenuous at worst" not to consider the status of grizzlies outside the Yellowstone region, one of the few areas where they have bounced back.

State and federal officials reacted with disappointment. Wyoming Gov. Matt Mead said the ruling provided evidence of flaws in the Endangered Species Act and the need for Congress to make changes.

"Grizzly bear recovery should be viewed as a conservation success story," Mead said in a statement.

Pressure to lift protections and allow hunting has increased in recent years as the number of conflicts between bears and people increased. Most of those conflicts involve attacks on livestock but occasionally bears attack people, such as a Wyoming hunting guide killed earlier this month by a pair of grizzly bears.

The ruling marks a victory for wildlife advocates and Native American tribes that sued when the Interior Department last year revoked federal protections. They argued that the animals face continued threats from climate change and loss of habitat.

Tim Preso, an attorney with EarthJustice who represented many of the plaintiffs, said Christensen's ruling made clear that the government had moved too hastily to remove protections because bears are absent from much of their historical range.

"Putting the blinders on to everything other than Yellowstone grizzlies was illegal," he said. "We tried to get them to put on the brakes, but they refused to do that."

The grizzlies living in and around Yellowstone were classified as a threatened species in 1975 after most bears had been killed off early last century and the population was down to just 136 animals.

Government biologists contend Yellowstone's grizzlies are now thriving, have adapted to changes in their diet and are among the best-managed bears in the world.

U.S. Fish and Wildlife Service spokeswoman Jennifer Strickland said the agency was reviewing Monday's ruling but stood behind its decision to lift protections.

The agency initially declared a successful recovery for the Yellowstone population in 2007, but a federal judge ordered protections to remain while wildlife officials studied whether the decline of a major food source — whitebark pine seeds — could threaten the bears' survival.

The Fish and Wildlife Service concluded last year it had addressed that and all other threats and said the grizzlies were no longer a threatened species requiring restrictive federal protections for them and their habitat.

That decision turned management of the bears over to the states, which agreed on a plan that set hunting quotas based on the number of deaths each year to ensure the population stays above 600 animals.

The federal agency has been moving toward lifting federal protections for another group of about 1,000 bears living in Montana's Glacier National Park and the Bob Marshall Wilderness, but it first wanted to see how Christensen ruled on the Yellowstone case.