Our butts used to be sperm dispensers.

Science Alert reports on an evolutionary study that has found our butts (from which everybody, as the children’s book tells us, poops) were originally a little bit more risque. The earliest anus apparently developed from an aperture originally used to distribute male sex cells:

Researchers from the University of Bergen in Norway investigated the genetics of xenacoelomorphs; distant relatives of flatworms that have a cul-de-sac for a gut. Despite this lack of a dedicated poop-hole, xenacoelomorphs use some of the same genes we use to turn our digestive system into a tube, only to create a genital opening known as a gonadopore instead.

“Once a hole is there, you can use it for other things,” zoologist Andreas Hejnol told Michael Le Page at New Scientist.

Developmental biologist Carmen Andrikou and team found that when the xenacoelomorph inverts its outer skin to develop a gonadopore, it uses some of the exact same genes other animals use to make their butt holes.

A number of animals today, including birds and platypus, also have a joint hole for both reproductive and digestive functions – a cloaca.

“The presence of cloaca within animals as well as the gonopore-oral fusion witnessed in species of [flatworm], suggests that a connection between the digestive and the reproductive system is either easy to evolve convergently or shares a common ancestry,” Andrikou and colleagues write in their paper, which is still awaiting peer review.

This all suggests that our anuses evolved after a male’s sperm chute merged with the digestive tract to form a second opening, the researchers explain – implying animals didn’t evolve anuses until after our own branch of the family tree parted ways with xenacoelomorphs’ ancestors.