TRAVERSE CITY, Mich. — A federal appeals court Tuesday retained federal protection for gray wolves in the western Great Lakes region, ruling that the government made errors when it dropped them from the endangered species list five years ago.

The court upheld a district judge who overruled the U.S. Fish and Wildlife Service, which had determined that wolves in Michigan, Minnesota and Wisconsin had recovered after being almost exterminated in the previous century. They total about 3,800.

Even so, courts have sided with environmental groups led by the Humane Society of the United States, which have sued to block the service’s repeated efforts to strip wolves in the region of their protected status. The service made its latest attempt in 2011. U.S. Judge Beryl A. Howell struck down the plan in 2014.

In a 3-0 ruling Tuesday, a panel of the U.S. Court of Appeals for the District of Columbia Circuit said the service had not sufficiently considered important factors. They included how loss of habitat would affect the predator’s recovery and how removing the Great Lakes population from the endangered list would affect wolves elsewhere. As long as wolves are on the protected list, they cannot be killed unless human life is at risk.