Demographers have long noticed that, when times get tough, there’s a conspicuous uptick in the number of baby girls versus boys born. Cultural factors like selective abortions do not explain the trend; evolutionary biology might. Discover explains the theory supporting a female-heavy population during trying times, first outlined by a biologist and mathematician in 1973:

The Harvard-based pair theorized that as the physical condition of a female declines — if she’s nutritionally deprived, for example — she’ll tend to produce a lower ratio of male to female offspring. Evidence of the theory came from red deer and humans; in both species, adverse conditions in the mother’s environment during pregnancy are correlated with a shift toward female births.

Under normal circumstances, mammals such as ourselves tend to naturally lean towards male-dominant birth rates, with boy babies accounting for about 3 percent more births than females. This is likely because men, whether animal or human, have higher death rates than women, Discover writes. Biology is automatically correcting for that loss.

However, that ratio naturally changes during difficult times, such as during a long-term famine.

Under certain conditions, biologists say, an imbalance favoring female births can improve the reproductive success of an individual organism. Trivers and Willard argued that the strongest and most dominant males of a species were far more likely to leave offspring than weaker males, while virtually all females would reproduce. According to this so-called adaptive sex ratio adjustment hypothesis, healthy mothers were better off producing sons, who would likely be fit and go on to reproduce, whereas mothers in less prime condition would benefit more from daughters, who would reproduce regardless of their low health status. The strategy allowed a mother to “maximize her eventual reproductive success,” the two wrote in their seminal paper.

Real-life disasters have created data that support this idea. During China’s Great Leap Forward, around 30 million people died from starvation. The rate of male births also declined. One recent study of demographic data from 310,000 Chinese women during that time found that the male birth rate remained low up to two years after the famine ended, Discover reports, adding that similar findings held true for post-Communist Poland and during times of famine in Portugal.

The mechanism behind this finding, and what it takes to trigger this decline, however, are harder questions to answer. One study, Discover reports, found that males during pre-embryonic development have lower rates of survival than females when a mother’s blood sugar levels are down, so it could be that the selection pressure happens after conception.

As for the amount of stress required to trigger the bias, some researchers say a period of a few months, for example, would not be enough. A study described by ScienceNOW did not find any impacts on babies born during the Dutch famine, which lasted seven months. Others, however, argue the opposite. One Columbia University researcher published a paper showing that women who fast during Ramadan and conceive during that time have significantly more female than male babies, ScienceNOW writes, implying that a mother’s nutrition in fact has a very immediate effect on her baby’s gender.

More from Smithsonian.com:

Mississippi Baby May Have Been Cured of HIV

Easy-Peasy Test Finds Serious Fetal Health Issues Earlier