A giant prehistoric ‘toilet’ has been unearthed in Argentina after scientists uncovered thousands of fossilised feces deposited 240-million-years ago.

The dung deposited by rhino-like megaherbivores was clustered together, suggesting for the first time that ancient reptiles shared collective dumping grounds.

The communal latrines are now being described as the world's oldest public toilet.

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

Many modern animals defaecate in socially agreed spaces for social and biological reasons, such as to mark territory, as a defence against predators and to prevent intestinal parasite re-infestation.

The fossil 'coprolites', which were up to 40cm wide, were discovered in patches across the Chanares Formation in La Rioja province. These dung piles were deposited there by the Dinodontosaurus, an eight-foot-long ancient animal similar to the rhino, common in the Triassic period.

The researchers recorded a density of 94 poos per square metre, spread across patches 900 square metres in size and preserved by a sheet of volcanic ash, lead researcher Dr Lucas Fiorelli told the BBC.

The study, published in Scientific Reports, could provide more information on diet and diseases.

“When cracked open they reveal fragments of extinct plants, fungi, and gut parasites,” Martin Hechenleitner, a fellow author on the study said.

“Each poo is a snapshot of an ancient ecosystem - the vegetation and the food chain."

The authors concluded: "This is the first evidence of megaherbivore communal latrines in non-mammal vertebrates, indicating that this mammal-type behaviour was present in distant relatives of mammals, and predates its previous oldest record by 220 Mya."