Apart from humans and our close relatives, the only animals that menstruate are elephant shrews and certain bats. Why did it only evolve in these species?

I got my first period when I was only 11.

In the first few years, my periods were not only a source of occasional embarrassment, they were also excruciatingly painful. I would lie curled up in my bed with a hot water bag, unable to move or breathe, and I would wonder: "why me?"

Of course, I wasn't the only one: most women menstruate. But most other female animals don't bleed outwardly like us. Even among those that give birth to live young as we do, only a handful of species menstruate.

So menstruation isn't just inconvenient and unpleasant: it's also a mystery. Why do we menstruate at all? And if it's such a good idea, why don't other animals do it?

Menstruation is part of a woman's reproductive cycle. Every month, in response to reproductive hormones – mainly oestrogen and progesterone – a woman's womb gets ready for pregnancy.

Women lose 30 to 90 ml of fluid over 3-7 days of menstruation

The inner lining of the womb, known as the endometrium, prepares for an embryo to implant in it. The endometrium thickens, divides into different layers and develops an extensive network of blood vessels.

If the woman doesn't get pregnant, progesterone levels begin to fall. The thick endometrial tissue with its blood vessels then begins to slough off, and passes out through the vagina. This bleeding is menstruation.

On average, women lose 30 to 90 ml of fluid over 3-7 days of menstruation. We know, because scientists have given women pre-weighed pads and tampons, and weighed them again after use.

On the face of it, this seems like a rather wasteful process. As a result, many people have attempted to explain why we do it.

"Some of the early thoughts on menstruation were that it was removing toxins from the body," says Kathryn Clancy, an anthropologist at the University of Illinois in Urbana.

Schick concluded that menstruating women excreted toxic substances from their skin

Much of the research in the early 1900s was coloured by deeply entrenched taboos against menstruating women, some of which persist even today.

For instance, Bela Schick, a popular physician, conceived the term 'menotoxin' in 1920. He ran experiments in which menstruating and non-menstruating women handled flowers. Schick concluded that menstruating women excreted toxic substances from their skin that caused flowers to wilt.

These menotoxins, according to Schick, also stopped the growth of yeast and prevented dough from rising. Schick postulated that the menotoxins might seep into a menstruating woman's sweat as well.

Others corroborated his conclusions, concluding that toxins from menstruating women could wither plants and spoil beer, wine and pickles.

Most of these studies were very poorly designed

"There was this idea at this time that women are just awful and disgusting," Clancy says. "The problem is that they tried to keep saying this all the way to the 70s."

In reality, Clancy says that most of these studies were very poorly designed, so they didn't really show that menotoxins exist.

In 1993, a very different hypothesis about the function of menstruation captured popular media attention. Margie Profet, then at the University of California Berkeley, suggested that menstruation's function is to "defend against pathogens transported to the uterus [womb] by sperm".

"Instead of saying that it is women that are dirty, she said that it is men who are dirty," Clancy says. "We need to flush out the dirtiness of men in order to reduce our chances of venereal disease."

Scientists found no link between female promiscuity and menstrual bleeding

Profet's idea quickly fell down for lack of evidence. For instance, it predicts that there should be more disease-causing organisms in the womb before menstruation than after. But this wasn't borne out. Some studies even suggested that menstruation increases the risk of infection, because bacteria grow well in blood, which is rich in iron, proteins and sugars. Moreover, during menstruation there is less mucus around the cervix, making it easier for bacteria to enter.

Profet made another prediction. If the females of a species mate with multiple partners, they should bleed more, because they would be at greater risk of exposure to sperm-borne diseases. But scientists found no link between female promiscuity and menstrual bleeding.

One of Profet's leading critics was anthropologist Beverly Strassmann of the University of Michigan in Ann Arbor. In 1996, she put forward her own idea.

Strassmann argued that if we want to understand why menstruation occurs, we must figure out why animals' wombs go through reproductive cycles: not just humans, but other mammals too.

It costs a lot of energy to maintain a thick, blood-filled layer

Other female mammals build up the inner walls of their wombs just like women do. If they don't get pregnant, they either re-absorb this material, or let it bleed out.

It costs a lot of energy to maintain a thick, blood-filled layer inside the womb all the time, Strassmann argued. It might actually use less energy to tear down the lining and regrow it. "I used energy economy, not to actually explain the bleeding, but to explain why there is this cyclicity in the first place," Strassmann says.

Then it's a matter of whether the female can re-absorb all the blood efficiently. If there is too much, it might be simpler to menstruate. "The fact that there is blood loss in some species is not an adaptation, but a side effect of species anatomy and physiology," says Strassmann.

Strassmann was not alone in proposing that menstruation is a by-product, rather than something evolution had specifically favoured.

Embryos have pushed deeper and deeper into the mother's tissue

Colin Finn, then at the University of Liverpool in the UK, suggested something similar in 1998. His idea was that menstruation is a necessary consequence of the way the womb evolved, rather than a way to conserve energy as Strassmann had suggested. 

According to Finn, embryos have pushed deeper and deeper into the mother's tissue, and the womb lining has defended itself against the embryo by thickening and forming layers. This thick lining is perfectly receptive to the embryo, but only for a few days. After that, if the woman isn't pregnant, the lining must be got rid of.

Both these ideas are neat. To figure out the truth, we need to compare animals that do and don't menstruate.

Apart from humans, most of the other menstruating animals are primates, the group that includes monkeys and apes as well as humans. Most monkeys living in Africa and Asia, such as rhesus macaques, menstruate.

Great apes do it too. Menstrual bleeding is easily detectable in chimpanzees and gibbons. However, gorillas and orang-utans bleed less copiously, so menstruation is only visible on closer inspection. Other primates, such as tarsiers, may also menstruate, but there is little hard evidence.

Other than our close relatives, menstruation also evolved independently in two other groups: some bats and elephant shrews.

Bats that menstruate belong to two families called the free-tailed bats and the leaf-nosed bats, says John J Rasweiler IV, a retired professor from the State University of New York, and an expert on bat reproduction.

The list of animals that menstruate is quite short

In these species, menstruation is similar to that of humans. For instance, short-tailed fruit bats have cycles lasting 21-27 days, almost as long as that of humans, says Rasweiler. Menstruation also appears to last a similar length of time.

However, bleeding in bats is not as clearly visible as in humans. "This is understandable because the menstruating bats are much smaller animals and have smaller blood vessels vascularizing their uterine lining," says Rasweiler.

It seems the list of animals that menstruate is quite short: humans, apes, monkeys, bats and elephant shrews. What do these seemingly disparate animals have in common?

It all comes down to how much control the mother animal has over her own womb, according to Deena Emera of Yale University in New Haven, Connecticut. In a paper published in 2011, Emera and her colleagues pointed out that in menstruating animals, the transformation of the womb wall is entirely controlled by the mother, using the hormone progesterone.

These changes to the womb are triggered by signals from the embryo

Embryos can only implant in the womb wall if it is thick and has specialised large cells, so this means the female is effectively controlling whether or not she can get pregnant. This ability is called "spontaneous decidualisation".

In most other mammals, these changes to the womb are triggered by signals from the embryo. In effect, the womb lining thickens in response to pregnancy.

"There's a nice correlation between species that menstruate and species that exhibit spontaneous decidualisation," says Emera.

Assuming this pattern holds, Emera seems to have identified the key question. Why do some females control their own womb linings, while others allow their unborn embryos to control them?

"We argue that spontaneous decidualisation likely evolved because of the conflict between the mother and the foetus," Emera says.

A foetus will dig through all the womb lining to directly bathe in its mother's blood

"We put forward two possibilities, especially in primates." The first is that spontaneous decidualisation may have evolved to protect the mother from an aggressive foetus.

All foetuses burrow into the linings of their mothers' wombs, in search of nourishment. But some do this more than others.

In horses, cows and pigs, the embryo simply sits on the surface of the womb lining. In dogs and cats, the foetuses dig in a little more. But in humans and other primates, a foetus will dig through all the womb lining to directly bathe in its mother's blood.

That's because mothers and babies are engaged in an "evolutionary tug-of-war", says Elizabeth Rowe of Purdue University in West Lafayette, Indiana.

The mother responded by putting up her defences

The mother wants to ration how much nutrients she gives to each baby, so she has some left and can have more babies. On the other hand, the developing baby wants to get as much energy from its mother as it can.

"As the foetus became more aggressive, the mother responded by putting up her defences before the invasion actually began," says Emera.

The second possibility is that spontaneous decidualisation evolved to get rid of bad embryos.

Human embryos are very prone to genetic abnormalities, which is why so many pregnancies fail in the first few weeks. This might because of our unusual sexual habits, says Emera.

An egg may be several days old by the time it gets fertilised

"Humans can copulate anytime during the reproductive cycle, unlike many other mammals that copulate right around ovulation," says Emera. This is called "extended copulation". Other menstruating primates, some of the menstruating bat species, and the elephant shrew all engage in extended copulation. 

As a result, an egg may be several days old by the time it gets fertilised, says Emera. Ageing eggs may result in abnormal embryos.

Once the womb lining has thickened and changed, its cells develop the ability to recognise and respond to defective embryos. So spontaneous decidualisation may be a way for the mother to save her resources, says Emera. "It prevents her from investing in a bad embryo, lets her get rid of it right away, and primes her body for another successful pregnancy."

This makes a fair bit of sense. Almost all menstruating mammals have long pregnancies and invest a lot in producing one or two babies at a time. As a result, losing even a single baby comes at a high cost, so evolution would favour anything that helped avoid doomed pregnancies.

Human menstruation is an accidental by-product of how our reproduction evolved

In line with this idea, a study published in 2008 found that rhesus macaque embryos are also prone to genetic abnormalities. But we don't have similar data for many other species, says Emera, so this idea can't be properly tested.

While we can't yet be sure why spontaneous decidualisation evolved, we are still closer to answering the riddle of menstruation. The ideas of Strassmann, Finn and Emera all suggest that human menstruation is an accidental by-product of how our reproduction evolved. It could be a consequence of our aggressive foetuses, or our habit of mating regardless of whether women are ovulating, or both.

In species that reproduce differently, menstruation never had to happen. In fact, menstruation itself used to be a rare event. In the wild, and in some human societies, it still is.

This is because wild mammals that menstruate spend most of their time either pregnant or nursing a baby. It actually takes considerable luck to catch one of them menstruating, says Rasweiler.

Menstruation is also rare in human societies that don't use any form of contraception. There are a few such "natural fertility" populations even today, and women in these societies spend most of their reproductive life either pregnant or breastfeeding.

Among the Dogon, a natural fertility population in Mali, Strassmann has found that women have about 100 periods over their lifetime. This was probably fairly typical for much of our species' history.

By contrast, most modern women have 300-500 periods. "What we are experiencing, as part of our evolution, is very unusual," says Strassmann.

"There are women who are sometimes afraid of not having a period," says Clancy. "I think understanding the origins of how our body works helps us realize that the boundaries of normal are much wider than we might think. Rather than pathologising every little tweak and every little difference we have, maybe we should leave it alone a lot more."

What would 11-year-old me have made of these ideas? None of them would have made my first periods any less painful. But I might have felt a bit better if I had been able to see my discomfort from such a broad perspective.