Sloths’ toilet habits have long confused biologists. Although this enigmatic tree-dweller is famously slow-moving (they climb at a maximum speed of around eight feet per minute) they're still pretty safe from predators as long as they stay in the tree tops.

Yet once a week (they have very slow metabolisms – that’s what eating only leaves does to you) sloths will descend from the safety of the canopies for a toilet break on the forest floor. Doing so makes them incredibly vulnerable to predators and yet they persist - with many even having favourite trees that they will return to again and again when nature calls.

Biologists have offered a number of explanations (could they be fertilizing a favourite tree? Are they picking up minerals from the soil to supplement their diet?) but none have quite held water. Now, one specialist thinks he might have the answer, and oddly enough it’s as much about moths as it is about sloths.

Download the new Independent Premium app Sharing the full story, not just the headlines

Jonathan Pauli, an assistant professor at the University of Wisconsin, Madison, first got interested in the sloth poo mystery after watching a video on YouTube from a David Attenborough documentary named “Mouldy Sloth”.

In the video Attenborough describes how the sloth has developed an unusual system of camouflage by letting its fur become infused with algae. In the rainy season these “algae gardens” turns green to match the lush jungle vegetation, and in the dry season they fade in colour along with the plants.

This creates a miniature ecosystem in the sloth’s fur, and alongside the plant life there are also plenty of moths present. In some cases, biologists have found up to 120 specimens living on a single sloth ("Imagine an infestation in a shag pile carpet on top of a compost heap,” says Attenborough) but it’s these insects that Pauli thinks holds the key to the sloth’s odd toilet habits.

Whilst studying three-toed sloths in their native habitat in San José, Costa Rica, Pauli observed how these moths would hop off the animal went it went to the loo and lay their eggs in the sloth’s dung. When these eggs hatched the moths would then fly back into the sloth’s fur, and the whole cycle would start again.

Most importantly, when the insects die and decompose in the sloths fur they provide essential nutrients that encourage the growth of the algae. Pauli tested various hair samples from different sloths and found that the more moths on the animal the more ammonium - a key fertilizer - was present in their fur.

So, by choosing to defectae on the floor rather than from the trees, the sloths could be encouraging the moths' lifecycle which in turn helps the alge grow. Not only does this algae provide the sloths with camouflage, but it’s also been theorized that the animals eat the stuff when grooming one another.

It may sound an unappetizing meal but the extra minerals, fat, and calories in the plant life could be vital in supplementing sloths' strictly vegan diet. Pauli's theory has yet to be completely proven, but it offers one of the best explanations for this peculiar and charming animal's mysterious toilet habits.