BILLINGS, Mont. — A federal appeals court has set aside the conviction of a Ferndale man who shot three grizzly bears that he claimed killed some of his chickens.

A three-judge panel of the 9th U.S. Circuit Court of Appeals ruled Wednesday that a magistrate judge erroneously rejected Dan Calvert Wallen’s contention that he killed the bears out of fear for himself and his family.

Wallen was convicted in 2015 of unlawfully taking a threatened species and sentenced to three years of probation and $15,000 in restitution.

Prosecutors had argued that conflicting statements from Wallen after the killings undermined his claims of self-defense. But the panel said Wallen could make such claims even if his fears were unreasonable.

The decision sends the case back to a lower court for a new trial.