It is a biological curiosity that has perplexed scientists and fascinated the internet.

Now researchers believe they have solved one of the animal kingdom’s smelliest mysteries: how wombats produce cuboid poo.

The podgy marsupials’ six-sided portions of dung are unique in nature. And they produce them prolifically, depositing between 80 and 100 cubes each night.

Wombats’ distinctive defecation has an important function, allowing the animals to pile their faeces high to mark their territory and communicate through scent.

The pellets’ flat sides mean they can be placed prominently on logs and rocks without rolling away, making them more likely to catch the eye of a mate.

But scientists have always been uncertain how wombats – which have circular anuses – fashion their faeces into their unusual shape. Now, a team of US mechanical engineers and Australian biologists believe they have flushed away any doubt.

Lead study author Patricia Yang, a postdoctoral fellow at the Georgia Institute of Technology, set out to investigative if differences in wombats’ soft tissue structures might explain their oddly shaped dung.

“The first thing that drove me to this is that I have never seen anything this weird in biology. That was a mystery,” said Ms Yang, who studies the hydrodynamics of fluids, including blood, processed food and urine in the bodies of animals.

She added: “I didn’t even believe it was true at the beginning. I googled it and saw a lot about cube-shaped wombat poop, but I was sceptical.”

Researchers studied faeces taken from wombats that had been killed in road accidents (Georgia Institute of Technology)

The researchers studied the digestive tracts of wombats that had been put down after being hit by road vehicles in Tasmania, Australia.

Near the end of the intestine, they found that faeces changed from liquid states to solid states made up of small, separated cubes. The researchers concluded that the varying elastic properties of wombats’ intestinal walls allowed for cube formation.

In the manmade world, cubic structures are commonly produced by injection moulding or extrusion. But in nature the shape is extremely rare: wombats are the only known species capable of producing cubes organically.

Ms Yang said her findings could have implications for manufacturing, as well as contributing to scientific understanding of soft tissue transportation.

“We currently have only two methods to manufacture cubes: We mould them, or we cut them. Now we have this third method,” Ms Yang said. “It would be a cool method to apply to the manufacturing process – how to make a cube with soft tissue instead of just moulding it.

“We can understand how to move this stuff in a very efficient way.”

Support free-thinking journalism and attend Independent events

Scott Carver, an Australian biologist involved in the study, added: “There is much general interest from the public, both in Australia and internationally, about how and why wombats create cube-shaped faeces.

“Many ideas, some more entertaining than others, have been put forward to explain this, but until this study nobody had ever investigated the cause. This has been a fantastic collaboration, which shows the value of interdisciplinary research for making new scientific discoveries.”