In the mountainous cloud forests of Borneo, nothing goes to waste, and that includes waste itself. Here, the largest carnivorous plant on Earth has evolved to become a sort of customised outhouse for local tree shrews (Tupaia montana).

With a toilet seat perfectly contoured to the mammal's backside, this huge, jug-shaped pitcher plant (Nepenthes rajah) survives not by swallowing insects, as do many of its close relatives, but by devouring nutrient-rich faeces.

It's one of the most peculiar and puzzling plants on Earth, with a pitcher so large it can hold two litres of water and glands so busy they produce huge quantities of nectar. Yet it's only in the past decade, more than 150 years after the plant's discovery, that scientists have truly understood the purpose of its sweet juice.

By using nectar to tempt the tree shrews, researchers say this pitcher plant is basically "a toilet with a feeding station".

Video observations reveal tree shrews jumping onto the pitcher plants and licking nectar from their leafy lids, all the while marking their territory with little droppings. You can see this in action in the David Attenborough video below.

These 3 pitcher plants grow where insects are scarce & so evolved 'toilets' for shrews, which excrete in the pitchers, fertilising the plant pic.twitter.com/EBvN9K7t8R — Chris Thorogood (@thorogoodchris1) January 8, 2017

In a region where mosquitoes are scarce, this carnivorous plant appears to have followed a unique evolutionary path. Unlike other pitcher plants, N. rajah is particularly sturdy, with a shrew-shaped orifice and a non-slippery rim, allowing the shrews to stick around and feed for longer.

At the same time, the shape of this pitcher plant's funnel also ensures the shrew's poo ends up in the bowl, whether by gravity or rain runoff.

(Ch'ien Lee/Wikimedia/CC BY 2.5)

As strange as it sounds, the plant's appetite is not an anomaly. Another pitcher plant has developed a similarly mutual relationship with bats. N. hemsleyana provides a shelter for the woolly bat (Kerivoula hardwicki) to roost in during the day, and in return feasts on the bat's droppings.

Meanwhile, the same shrews have been found toileting in other carnivorous pitcher plants, including N. lowii and N. macrophylla. But while the ground-based N. lowii has effectively lost the capacity to trap animals, both the other species can still capture arthropod prey, as well as feed on shrew poo.

"These 'tree shrew toilets' have concave, reflexed lids oriented to position the animal for optimal faeces capture," explains Chris Thorogood, an evolutionary geneticist and plant taxonomist at the University of Oxford, in a blog post.

"Tree shrew toilets may have evolved from pitchers with broad pitcher mouths adapted for enhanced water or leaf litter capture."

(Ch'ien Lee, Bio Letters, 2011)

While shrew poo may not sound like the most appetising meal, it is rich with nutrients that pitcher plants need to survive, like nitrogen and phosphorous. In fact, recent research has found that shrew faeces account for "57–100 percent of foliar nitrogen" in the N. lowii species alone.

It's a win-win situation for everyone involved, but there are still many details that need to be teased out. For instance, how exactly does the tree shrew know when the pitcher plant is ready to hold it?

A newly-formed pitcher takes days to become sturdy enough for visitors, yet most in the wild show little signs of damage, indicating that the tree shrew is a patient feeder.

"One possible explanation for this is that the plants signal the tree shrews to indicate whether or not individual pitchers are "open for business," one study hypothesises.

For example, in N. lowii, the inner surface turns to a solid, dark purple when the plant matures, potentially letting tree shrews know that it is ready to be landed on.

"The fact that the aerial pitchers are so tailored to the shape and activities of the tree shrew suggests this has been going on for a long time," ecologist Jonathan Moran of Royal Roads University in British Columbia told Live Science in 2009.