FOR something so private and covert, the selective abortion of female fetuses is an oddly common topic of conversation in India. Narendra Modi, the prime minister, exhorts his countrymen to save girls and send them to school. When Sakshi Malik won India’s first medal at the Rio Olympics, in wrestling, it was an occasion for regret as well as national chest-beating. Such victories are only possible when girls are not killed, commented Virender Sehwag, a dashing cricketer turned Twitter star.

India has cause to fret. According to two demographers, John Bongaarts and Christophe Guilmoto, a staggering 45m girls and women are missing from the country. Some were never born, having been detected by ultrasound scans and aborted. Others died young as a result of being neglected more than boys. Some villages in the north have an alarming surplus of boys and young men. Yet attitudes and behaviour are changing. In India, and in the world as a whole, the war on baby girls seems to be winding down.

Even without human meddling, the sex ratio is skewed. Asians and Europeans tend to have about 105 boys for every 100 girls, whereas Africans have closer to 103 boys. That seems to be nature’s way of compensating for the higher death rate of boys and men; by the time men and women are ready to have children, the numbers ought to be roughly balanced. But in a few countries the ratio is unnaturally high. At the last census, in 2011, India had 109 boys aged 0-6 for every 100 girls; in Punjab, a wealthy northern state, the ratio was 118 to 100. China had 119 boys aged 0-4 for every 100 girls in 2010.

Sex ratios go out of whack when three things occur at once. First, a large proportion of couples must fervently desire boys. That happens mostly in “patrilocal” societies, where a woman moves out of her parents’ home upon marriage and into her husband’s home, to dote on his parents and harvest his family’s crops. Second, birth rates must be low. A couple who intend to have five or six children (as Nigerians do today, for example) will almost certainly get a boy just by the law of averages, whereas a couple who would like one or two children are more likely to try to tip the odds. Third, there must be an accessible, tolerated way of getting rid of superfluous girls. Today, that is usually abortion.

All three things used to be true of South Korea (see article) and they are true today of China, India, Pakistan, Vietnam and the south Caucasus. They hold in parts of Indonesia but not the whole country. Indeed, Indonesia has an unusual group that proves the rule. The Minangkabau, from West Sumatra, practice matrilocality—that is, newly married couples move into the wife’s household. They have a normal sex ratio. But birth data suggest that they are hungry for daughters. A Minangkabau who gives birth to a boy will, on average, have a second child more quickly than one who gives birth to a girl.

Uptown girl

The first signs that sex ratios might be returning to normal appeared after the last round of censuses. The sex ratio among China’s children, which had risen steadily for decades, did not budge between 2000 and 2010. In India, the excess of boys over girls worsened slightly between 2001 and 2011. But more girls were counted in the states where sex selection had been most common, such as Haryana and Punjab.

Annual data on births, which are less authoritative than census figures on children but more up-to-date, suggest the tide has turned. India’s sex ratio at birth has become more normal over the past decade, especially in cities (see chart). In China—where, admittedly, official figures of all kinds are fishy—the sex ratio at birth has fallen from a peak of 121 boys per 100 girls in 2004 to 114 in 2015.

Vietnam still has too many male births, but the situation has not worsened since about 2010. Armenia and Azerbaijan are also holding steady; sex ratios had become unbalanced in both countries in the 1990s. Sex selection is disappearing in Georgia and Taiwan. Then there is South Korea, the country that most cheers demographers. In 1990 it had a sex ratio at birth of 116 to 100. For the past three years the figure has been 105—precisely what it should be. Something is driving sex ratios back to normal levels. But what? Not, probably, the efforts that some countries have made to crack down on sex-selective abortion. Indian couples find it easy to circumvent an official ban by booking their ultrasound scans at one clinic and their abortions at another. The Chinese authorities have cracked down harder, scrutinising couples who already have a girl and are thus highly likely to abort another female fetus. The sex ratio for second births in China duly became more normal. But, as Monica Das Gupta of the University of Maryland, an expert on the subject, points out, some Chinese couples simply moved to sex-selecting in the first pregnancy. Ms Das Gupta thinks that urbanisation is a more powerful force for change. A city-dwelling couple might be teased by neighbours for having only girls, but that is nothing compared with the pressure heaped on villagers by clan patriarchs and matriarchs. And young city-dwellers tend to live apart from their parents, which removes one reason for preferring sons. Now that children tend to support their parents by sending money, daughters are just as good. Urbanites have access to the latest medical technology, but they seem less keen on using it. As urban women grow more independent and more valuable to their parents, rural men are struggling. Years of skewed sex ratios mean there are already too many would-be grooms for every village bride. Worse, the women they might marry often head for cities, where they can find better husbands. “There’s an awareness that life is not great for males,” says Therese Hesketh of University College London, who follows sex ratios in China.

Indeed, rural Chinese men increasingly look like burdens on their parents. A remarkable paper by Shang-Jin Wei and Xiaobo Zhang shows that parents of sons in districts with high sex imbalances tend to save large amounts of money, fearing that they will have to splash out on houses, consumer goods and weddings if they are to snag a local girl. This effect is so strong, the authors calculate, that it explains about half the increase in China’s household savings rate between 1990 and 2007.

Spying a coming social catastrophe, governments have tried to cajole citizens into prizing girls by putting up posters or even offering them money. They might have changed a few minds. But officials have often muddled their message. Under China’s one-child policy, for example, couples who gave birth to a girl were often allowed to have a second child, implying that the state felt sorry for those who had failed to produce a boy. But where governments have been confused and half-hearted about the worth of girls, popular culture has been loud and insistent.

TV is good for you

For sheer attention-grabbing power, nothing beats TV in India. One study found that 51% of women in Kurukshetra, a district in the state of Haryana, had seen a soap opera called “Na Aana Is Des Laado” (Don’t Come To This Country, Beloved Daughter). That soap revolves around female infanticide: in one episode, a father murders his baby daughter by drowning her in milk. By contrast, just 5% of women in the district had seen a film produced by the government about the equality of boys and girls, and less than 1% had heard about the subject from religious leaders.

“TV is not just entertainment—it is a big source of education,” says Purnendu Shekhar, a writer of soap operas. One of his soaps, “Balika Vadhu” (Child Bride), is about the evil of child marriage. Mr Shekhar thinks the show changed attitudes, and it certainly entertained the country. “Balika Vadhu” ran daily for eight years, ending last July, and has also been popular in Vietnam. He believes even conventional soaps, which tend to hinge on conflicts between women and their mothers-in-law and dial all emotions up to 11, get viewers used to the idea of powerful women. “Stories with strong male protagonists do not work in India,” he says.

Studies of India have shown that TV-watching is associated with reduced preference for sons, even after controlling for wealth and other factors. That might seem implausible. But remember that Indians often distrust politicians and public officials, says Shoma Munshi, an expert on Indian soap operas. They are at least as willing to listen to actors. That is why TV and film stars often become politicians, or are used to front public-health campaigns.

Sex ratios remain highly unbalanced in many countries. But there is an important difference between a giant social problem and an endless one, and gendercide now looks like an example of the former. Mr Guilmoto believes that sex ratios will continue to normalise until they return to natural levels. Asia has engaged in a demographic experiment with disastrous consequences. It will surely not repeat it.