LONDON imports the young and exports the old, the theory goes—or went. For decades people have come to the capital to go to university or work, moving out again when their children require more space or education or when they retire. But a startling demographic change has drastically slowed the conveyor belt.

Births in the capital each year have soared by 25% since 2002, as British women who delayed childbearing finally got down to it and London's many immigrants produced in Stakhanovite quantities. London contributed fully 37% of England's natural population increase (the surplus of births over deaths) between 2009 and 2010. Many parents are now staying put, thanks to a sticky mortgage market that makes it hard for buyers to get a loan and a sticky labour market that makes it hard for anyone to be sure of a job. Half as many London properties were sold in 2010 as in 2004. Grandparents, too, are less keen on leaving than they were. Black and Asian immigrants who settled in London in the 1960s and 1970s are disinclined to move away from their families in London for the pleasures of, say, Margate.

So London is getting both younger and older—and above all bigger. Net outflows to the rest of Britain are half what they were in 2005, partly because more people have drifted into London. Net inflows from overseas, though dwindling, remain positive. On current projections London's population will swell from just under 8m now to over 9m by 2031, which is roughly the equivalent of annexing Britain's second city, Birmingham. Ethnic minorities are expected to account for almost three-quarters of the increase.

This expansion has coincided with the hardest squeeze on government finances in almost a century. So it is small wonder that city planners are scratching their heads over how to deliver services such as education and health care, and wondering where on earth, given London's long-running housing crisis, so many extra people are to live.

Primary schools have been the first to cry havoc. Since 2008 London Councils, a lobbying group representing London's 32 boroughs, has warned of the coming gap between the number of wriggling young bodies and the number of school places available for them. Now it is undeniable. School places are in short supply all over England, but the problem is especially acute in the capital. By 2015-16 greater London will need around 70,000 more school places, London Councils says. In November central government agreed to give the capital £250m ($390m) to increase school places—a step in the right direction, but nothing like what is needed.

Barking and Dagenham, in east London, is a case in point. With the fastest-growing birth rate in greater London over the decade to 2010 (up 58%), it also faces the biggest increase in demand for school places. At primary-school level this is set to rise by 43% between the academic years 2010-11 and 2015-16 (see map). In the past three years the borough has created almost 8,000 new primary-school places, some of them to accommodate the growing number of children who are brought to school after the official registration date. The council has diverted money meant for highways work, converted existing council offices into schools and discussed with private landlords the possibility of turning empty warehouses and shops into classrooms. Its share of the November hand-out was £24m. But in the five years to 2017 it reckons it will need at least 23 additional classrooms for the reception year, at least 34 more for 11-year-olds and 400 new sixth-form places, with more to come later. Adding this capacity, the borough reckons, would require some £50m a year over the period. No borough is likely to underestimate its future needs publicly. But these figures may not be too far off the mark. Like some other boroughs in outer London, Barking and Dagenham is beginning to feel the pressure as families, especially large ones, move away from inner London to cheaper accommodation farther out. House prices in the borough were the lowest in the London area in late 2011, on figures from the Land Registry, and rents were well below the city average. The drift to London's periphery is likely to increase as the government clamps down on welfare and other benefits. Less health, more care

Though schools are the biggest immediate pinch point as the population grows, there are implications for health care too. The National Health Service has long struggled to improve services to London's expanding, ethnically diverse and transient population. It has made notable improvements—in stroke treatment, in trauma care, in immunisation coverage—since Ara (now Lord) Darzi identified shortcomings in a widely-read analysis in 2007. This month NHS London launched a website on which family doctors' performance can be monitored by the public, which may help to drive up standards.

But maternity services are hugely oversubscribed in the baby boom (one hospital in east London, designed to handle 8,000 births a year, is sinking under 9,000-10,000). Maternal death rates are higher than elsewhere, in part because some mothers from ethnic minorities keep the good news to themselves until late in their pregnancies. Doctors' surgeries in the capital are often rather primitive one- or two-man affairs—and even these tend to be few and far between in the poorer parts of town. London hospitals have a reputation for treating elderly patients callously.

Health outcomes are not the only place where uncertainty lurks. How permanent are these new demographic trends? Will birth rates turn down again as the daughters of immigrants adopt British ways? Will foreigners find greener economic fields elsewhere? Will native Londoners? Flyers touting emigration services are beginning to appear in parts of town.

It's a frightening time for those planning education or health care or—worst of all—housing. “We thought we had it nailed,” says Baljit Bains, head of the Greater London Authority's demography unit. “We were a typical industrialised country, with fertility dropping and economic prosperity. Then these crazy fertility numbers came, and the economic downturn.” As so often, the capital is a crucible for experimentation.