CHINA is good at building defensive walls. But the record of its most celebrated one is mixed. In 1211 Mongol armies rode round the fortification in Zhangjiakou, the northern gateway to Beijing. Today the city lies on one of two routes that bring another relentless foe to the capital: sand. Blown from northern deserts and degraded drylands, it coats roads, clogs railways and desiccates pastures. According to Greenpeace, just 2% of China’s original forests are intact. Decades of rampant logging and overgrazing have speeded the degradation of its land and soil; over a quarter of its territory is now covered in sand.

Against this new foe, China is building another Great Wall, this time a green one. The Three North Shelterbelt Project is by far the world’s largest tree-planting project. Since 1978, 66 billion trees have been planted by Chinese citizens. By the project’s end, planned for 2050, it is intended to stretch 4,500km (2,800 miles) along the edges of China’s northern deserts, cover 405m hectares (42% of its territory) and increase the world’s forest cover by more than a tenth.

Tree cover in the Three North area has increased from 5% to 12% since 1977. But critics say the figures, which are published by the State Forestry Administration, which also runs the project, define dryness, and a healthy tree, rather loosely. And conditions in many areas belie the trumpeted successes. Zhao Wenju, a farmer from Zhangjia village, which is close to Beijing, says that a well that required him to draw water up 9 metres a decade ago has sunk to 60 metres below ground level. Hou Yuanzhao of the Chinese Academy of Forestry worries that dying poplars in this area, which is less dry than many others covered by the project, are the start of a widespread withering.

In contrast to successful attempts elsewhere to halt deforestation or replace recently felled trees, most of China’s planting is on long-barren land. Much is of non-native pines and poplars, which are easy to grow and produce wood that can quickly be sold as paper pulp or planks. The result is an “ecological mismatch”, says Jiang Hong of the University of Hawaii.

Just 15% of trees planted on China’s drylands since 1949 survive today, estimates Cao Shixiong of Beijing Forestry University. Many died of age, as those grown from cuttings (as most are) only have a lifespan of around four decades. But many were simply unsuited to the soil. Monocultures are prone to disease. In Ningxia, in northwest China, a pest wiped out 1 billion poplar trees in 2000—two decades of planting efforts. In arid areas trees may even aggravate desertification by depleting groundwater and killing grasses that bind the soil.

Most of the mega-scheme’s critics think that with the right plants and methods, it could succeed. And in some places the government has begun to restore native species: sea buckthorn, a shrub rooted out in the 1980s as a plague, is being replanted in dry regions. In 2012 the World Bank lent China $80m to grow a mix of indigenous shrubs and lay straw grids to stabilise sand dunes in Ningxia over five years.

But even as the sand is beaten back in isolated pockets in wetter areas, it is making advances in the wider war. In Minqin in the north-west, where two huge deserts are slowly meeting, the cost of tree-planting has risen more than tenfold since the 1980s, and trees are dying, or growing stunted. Since 2003, 450,000 people in Inner Mongolia have been moved off land to prevent it degrading further. It is perhaps the clearest sign yet that the Great Green Wall is failing to keep out the enemy.