IN ALL countries, a big influx of migrants tends to provoke grumbles among the natives. In China, however, the migrants most frequently grumbled about, and treated with the greatest hostility, are not foreigners but other Chinese: rural folk who move to the cities in search of a better life. This has been on show in the past few days in the capital, Beijing. On November 18th a blaze in a ramshackle warehouse-cum-apartment-block killed 19 people believed to be migrants from elsewhere in China. The authorities are now using “fire safety” as a pretext to drive thousands of other migrants out of the basements, air-raid shelters and shanties where they live (see article)—often by cutting off their electricity and water. It has amounted to a mass expulsion from the capital.

It is clear that officials are not simply aiming to prevent future fires. A few volunteers who have tried to set up shelters for people who have found themselves suddenly homeless in sub-zero temperatures have been ordered by police to close them. The capital has a long record of trying to limit the population of migrants from the countryside by making it harder for them to rent crummy accommodation, the only kind that most of them can afford. They cannot buy a home without being formally employed (which most are not) and having residency papers (which are almost impossible for them to obtain).

The government wants to restrict the growth of megacities such as Beijing. It says their large populations put too much strain on water supplies, roads, hospitals and so on. Efforts to ease such pressures on the capital have been dramatic. They have included spending tens of billions of dollars on piping and channelling more water into the city from hundreds of miles away—a project touted as the biggest of its kind in the world. Even more dramatically, in April the government announced plans to build a whole new city from scratch, about 100km (60 miles) from Beijing, where some businesses and universities will be relocated. That will cost another few hundred billion dollars. Beijing aims to have no more than 23m residents by 2020, compared with nearly 22m today—an implausible goal, without yet more abuse of migrants.

A better Beijing

Officials have an extra reason to curb the population in Beijing—one that is especially important to the ruling Communist Party: as the capital, the city must look its best and avoid any hint of instability. The leadership views any unrest in Beijing, however minor, as a potential threat to the party’s grip on power. Hence the thuggish treatment of shanty-dwellers and the routine shakedowns by police of any shabbily dressed person heading towards Tiananmen Square. Who knows what chaos might be unleashed by a protest there about unpaid wages, abusive bosses or other migrant grievances?

There are ways of easing the capital’s growth pains that would be both more humane and more efficient. Water is scarce largely because it is too cheap. Pricing it properly—so that it reflects supply and demand—would spur households and businesses to use less of it. This would no doubt upset Beijingers, who have grown used to cheap water. But it would be less disruptive than building an entire new city down the road.

Above all, Beijing and other megacities should stop treating settlers from elsewhere in the country as second-class citizens. Refreshingly, some public intellectuals in Beijing signed a petition deploring the recent evictions as a violation of human rights. But all too often residents of the capital ignore the mistreatment of migrants. Many share the government’s worries about overcrowded schools and hospitals. But if the migrants were allowed to have proper jobs, they would pay more taxes and support more public services. Discriminating against them can be deadly. When they are, in effect, barred from formal, regulated housing, they end up in firetraps.

It would be better to give all Chinese citizens the same rights to live where they please and obtain public services where they live. Ideally that would mean abolishing the hukou system, which ties Chinese to the place their family came from. Failing that, the government should at least stop putting arbitrary caps on the populations of megacities. Such caps make no economic sense. The more people a city attracts, the more productive it becomes, as people forge millions of valuable connections with each other. Also, Beijing’s and Shanghai’s non-migrant populations are set to age and shrink as a result of declining birth rates. They will soon need migrants even more urgently than they do today. Out of self-interest, if nothing else, they should treat them decently.