(CNN)A federal judge may have given one of the planet's most endangered wolf species a glimmer of hope for survival.
In a searing decision aimed at the US Fish and Wildlife Service (USFWS), Chief Judge Terrence W. Boyle ruled that the agency violated the Endangered Species Act and the National Environmental Protection Act by neglecting its duty to protect the rare North Carolina red wolf.
There are only an estimated 40 red wolves remaining in the wild, confined to a refuge spanning five counties in northeastern North Carolina.
In his ruling, Judge Boyle wrote that the USFWS's decision to stop previously successful techniques for managing the red wolf population "amount to a failure (to) comply with its affirmative duty," and that revisions to its red wolf management policy were overly influenced by public pressure to stop recovery efforts.
The judge, of the U.S. District Court for the Eastern District of North Carolina, also made permanent a 2016 injunction which prevents the USFWS from capturing and killing red wolves without first showing that the animals are a threat to human, livestock or pet safety.
Monday's decision stems from a lawsuit filed against the agency during the Obama administration by the conservation groups Defenders of Wildlife, the Red Wolf Coalition and the Animal Welfare Institute, who argued the USFWS was jeopardizing the survival of the last remaining wild red wolves. The groups were represented by the Southern Environmental Law Center.
The species once inhabited a wide range stretching from Texas to Pennsylvania, but red wolves were reclassified as endangered in 1967 and declared extinct in the wild in 1980.
In 1987, four breeding pairs were reintroduced to North Carolina's Alligator River National Wildlife Refuge, and over decades of intensive management, the population rebounded and eventually peaked at between 120 and 130 wolves in the mid-2000s. For years, the red wolf recovery program was held up as a rare conservation success.
But since then, the number of red wolves has decreased. The species' population began falling sharply five years ago and by 2015 just 50 wolves were estimated to be left in the wild.
In his decision, Judge Boyle said the precipitous drop in wolf numbers coincided with seemingly arbitrary policy changes by the USFWS to stop protecting newborn pups or introducing new wolves into the wild, as well as the agency's decision to give landowners clearance to shoot wolves that stray onto their property.
When asked for comment Tuesday USFWS referred CNN to the Department of Justice, which declined to comment.
In a press release, the plaintiffs in the case praised the judge's decision.
"For four years now, the U.S. Fish and Wildlife Service has been dismantling one of the most successful predator reintroductions in U.S. history," said Sierra Weaver, senior attorney for the Southern Environmental Law Center. "The service knows how to protect and recover the red wolf in the wild, but it stopped listening to its scientists and started listening to bureaucrats instead. The law doesn't allow the agency to just walk away from species conservation, like it did here."