We’ve never seen symbiosis quite like this before. Scientists say goats’ Huck Finn-like propensity for climbing trees and spitting may actually benefit the trees they visit. The researchers published their findings in the journal Frontiers in Ecology and the Environment.

These animals will do just about anything to fulfill a craving. When there’s nothing available at ground level, domesticated Moroccan goats (Capra hircus) gladly clamber 30 feet into the uppermost branches of an argan tree (Argania spinosa) to get at its pulpy fruit.

Daniel*D, Wikimedia Commons // CC BY-SA 3.0

Rather than shouting at their goats to get down, herders encourage this wacky behavior, carrying goat kids to lower branches and teaching them how to climb. In the dry months of autumn, a herd may spend up to 74 percent of its foraging time in the treetops.

Dromedar61, Wikimedia Commons // CC BY-SA 3.0

The argan tree has long been important in its native region as a source of wood and a barrier against the Sahara’s creeping sands. Over the last few decades it’s also become something of a money-spinner, as more and more beauty products incorporate the honey-colored oil from its seeds.

That’s just fine with the goats. More trees mean more fruit for them, and it’s not the hard, stone-like seeds that they’re after. Researchers wondered how this highly unusual arrangement worked out for the trees. Many tree species depend on animals to disperse their seeds. It’s a trade: The animal gets to eat fruit, so long as it travels a little distance away before digesting it and pooping out the seeds.

But argan seeds are on the larger side, and researchers didn’t think goats would particularly enjoy trying to poop them out. To get a closer look, they fed domesticated goats six types of fruit. Then things got extra-glamorous, as they watched and waited for the goats to extrude the seeds.

And extrude they did—just not from the end you might expect. Rather than digesting and passing the whole fruit, the goats chewed it, swallowed it, digested it partially, then regurgitated it, chewed it again, and spit out the seeds.

The researchers collected those seeds and planted them, with great success. The majority of seeds had survived their harrowing journey through the front end of a goat and began to sprout.

This dispersal-via-spitting represents a previously unknown tree reproduction strategy. Goats are far from the only animals that chew their cud or spit it back out. This could be big.

“If spitting viable seeds from the cud is widespread among ruminants,” the authors note, “its ecological relevance could be important.”