The U.S. Fish and Wildlife Service has not done enough to protect the Mexican gray wolf, a federal judge said Monday in a ruling that delivers a much-needed victory to the endangered species that has been pushed to the brink by hunters and the ranching industry.

Friends of Animals, WildEarth Guardians, Western Environmental Law Center and New Mexico Wild had argued in their lawsuit that the FWS’ flawed 2015 Mexican wolf management ruling arbitrarily limited the population, banned the animals from suitable habitat and loosened provisions against killing them in the wild to appease the ranching industry.

“The Mexican gray wolf deserves a fair shot at recovery,” said Wildlife Law Program Director Michael Harris. “It’s FWS’ duty to conserve and recover the Mexican wolf, not to protect American livestock, hunting and trapping interests. Enough is enough. Restoring North American carnivores is vital to the health and restoration of our wildest places and ecosystems.”

The Mexican wolf is the smallest, rarest and most genetically distinct subspecies of gray wolf. The species was listed under the Endangered Species Act in 1978, but recovery efforts have largely foundered because the FWS has yet to implement scientifically recommended recovery actions.

For example, USFWS’ 2015 final rule refused to consider the only wild population of Mexican wolves as “essential” to the recovery of Mexican wolves in the wild. The rule also arbitrarily capped the population at 300-325, a level far below what scientists consider necessary for recovery, excluded the wolves from native habitat in northern Arizona, New Mexico, Colorado, and Utah, and allowed more killing of Mexican wolves by federal agents and private landowners over livestock conflicts.

U.S. District Court Judge Jennifer Zipps rejected each of these components of the rule. She noted that expanded killing allowances fails to take into account genetically important members of the population, which is so low that dangers of inbreeding and its attendant woes are present.

“The best available science consistently shows that recovery requires consideration of long-term impacts, particularly the subspecies’ genetic health,” Zipps said. “Moreover, this case is unique in that the same scientists that are cited by the agency publicly communicated their concern that the agency misapplied and misinterpreted findings in such a manner that the recovery of the species is compromised.”

According to the lawsuit in 2015, in the 1970s, the U.S. wolf population was virtually gone. A few individuals remained in northern Mexico. The two countries undertook a recovery plan, which involved a captive breeding program. By 1996, FWS established a plan that had an initial goal of producing a population of 100 Mexican gray wolves in the wild by 2005. In March of 1998, FWS released the first gray wolves from the captive breeding program into the wild.

The effort proved difficult, mostly due to illegal shootings of wolves by livestock owners and hunters. In response to local pressure, the forest service attempted to update its management plan that expanded the means by which locals could legally kill wolves. As of 2015, when the FWS released its latest flawed management rule, there were only 109 Mexican gray wolves left in the U.S.

“Mexican wolves have struggled for almost a century largely because of human efforts to eradicate the species,” said Judy Calman, staff attorney for the New Mexico Wilderness Alliance. “These embattled, iconic animals shouldn’t also have to struggle against the very agency tasked with saving them, and we’re extremely pleased that the court agrees.”