On the rocky cliffs of the Himalayas, the path to snow leopard conservation is paved in feces.

Their population decimated by poaching and habitat destruction, only about 4,000 of the endangered cats remain in the wild, according to the World Wildlife Fund. Conflicts with mountain farmers and pastoral herders also contribute to their dwindling numbers.

“The problem is when a snow leopard gets inside a livestock pen,” said Madhu Chetri, a biologist at Inland Norway University of Applied Sciences. When that happens, he said, the carnivore usually eats a handful of goats and sheep, but in some cases it can massacre more than 100 animals in a single corral.

If the cat gets stuck in a pen, the inevitable tends to occur. “There is a high chance the herders will kill it in retaliation,” he said.

Dr. Chetri and his team are studying conflicts between humans and snow leopards in areas of Nepal in order to find ways to mitigate them. That’s why they spent more than 150 days in the Central Himalayas sniffing out snow leopard scat. Embedded in the excrement were clues to decoding the cat’s diet and determining how often it ate livestock, which could one day guide conservation strategies to reduce contact between snow leopards and farm animals. They published their findings Wednesday in the journal PLOS One.