“RETURN to your hometown to work and care for your family”, reads a red banner strung over the main street of Fuxing, a hillside town in the heart of China. Until recently, farmers in surrounding villages dreamt only of getting away from their pumpkin patches and earning good wages in factories on the coast more than 1,000km (625 miles) away. Officials were happy to be rid of them. Now they are desperate to get them to stay.

Jintang county, to which Fuxing belongs, once enjoyed the dubious honour of being the biggest labour-exporting county in Sichuan province. Poor, deep inland and badly connected with overseas markets, Sichuan had little choice but to encourage its huge, underemployed rural population to find work elsewhere. Officials from counties like Jintang used to tour factory towns near the coast touting the merits of their surplus labour— and trading on the stereotype of the tough and determined Sichuanese.

In the 1980s and 1990s the number of people from Jintang who were working elsewhere grew from almost nothing to 180,000 (out of a population of 900,000). More than a third of them went to factories in Guangdong province (see map), the first area in China to cash in on the country's export boom. China's migrant workers like to stick close to others from their hometown, and many of Jintang's workers ended up in a single district of Dongguan, a centre of labour-intensive production in Guangdong, making everything from electronics to clothing. A street in Dongguan became known as Little Jintang. Chinese media say the Communist Party chief of Jintang used to visit local factories to persuade them to hire his county's migrants. Six years ago Jintang set up an office in Dongguan for this purpose.

The lure of home

A big change is now coming. Jintang is administered by Sichuan's capital, Chengdu, which like other inland cities is beginning to boom, thanks to a flood of government investment in recent years and the transfer of some manufacturing away from the coast in search of cheaper land and labour. In Fuxing walls and lampposts are plastered with job advertisements, not for work in distant coastal factories but for positions in and around Chengdu. Some of them offer jobs with Foxconn, a huge Taiwanese firm which makes Apple's iPads and other computer products at a plant near the city (for pay of more than 2,000 yuan—$320—a month, says one pink poster). Foxconn's largest factory is in Guangdong, but it opened a huge, modern operation in Chengdu in October 2010, and has talked of expanding to an astonishing 500,000 staff within five years. Chengdu officials have been scrambling to make sure that as many jobs as possible go to locals (who appear undeterred by a number of unexplained suicides at Foxconn's huge plants in China).

By a roadside in Fuxing, a few dozen young men and women from the surrounding countryside wait with piles of baggage for a bus to take them to Chengdu (though technically in Chengdu, Fuxing is two to three hours' drive away from the city proper, much of it along a winding country road). It is just after the lunar new year holiday, a time when migrant labourers have for more than two decades returned to the coast after spending the festival in their home villages. But for many of those at the bus-stop, Chengdu is their final destination. They crowd around your correspondent, regaling him with stories of how wages in Chengdu are now not much lower than on the coast, and how jobs nearby are getting easier to find.

In a change with implications that resound beyond this small, remote corner of China, such stories mark the beginning of the end of a phase in China's development: one that was marked by lengthy journeys and often miserable lives in faraway, Dickensian factories. Isolated Fuxing will soon be just a few kilometres from an expressway. Villagers are excited about the new road, not only because it will make travel to Chengdu much easier, but because it will bring business and job opportunities closer. Workers in Fuxing are putting the finishing touches to a large new open market and shopping complex.

Officials across the county have been busying themselves with what until three or four years ago would have been an unthinkable task: persuading migrants to stay in Jintang after the new-year festivities rather than go back to the coast. They hold meetings with migrant-worker representatives and offer tax breaks and help secure loans for those wanting to start up businesses. A government-owned newspaper in Chongqing, a region neighbouring Sichuan, even published a photograph of policemen carrying the bags of migrants returning to spend the new-year holiday there. In a country where officials (and long-established city-dwellers) often view migrant workers with disdain, the signal was clear: welcome home. A stretch limousine was provided by a Chongqing boss as a free shuttle service for the workers (see picture above).

Officials say that in 2011, for the first time, the number of local labourers migrating from one part of Chongqing region to another exceeded the number leaving for other provinces. Just a few years ago, 70% were going elsewhere. Xinhua, a state-run news agency, reported that since 2008, four-fifths of people leaving their homes for the first time in Henan, another big exporter of labour, had been migrating within Henan. Before then, it said, the same proportion had left for other provinces. In Sichuan the trend has been similar. In 2008, 58% of its 20m migrants were working outside the province. Last year the ratio dropped to 52%. A labour official in Chengdu says enthusiasm for staying close to home has been especially marked this year. One factor, he says, has been the difficulty that Europe's downturn has caused coastal factories producing export goods. (By no means all of the new jobs being created inland are in the export sector, the traditional employer of migrant labour.)

Migration over huge distances will remain a striking feature of China's labour market for years to come. Employment along the coast suffered huge disruption late in 2008 as a result of the global financial crisis, with millions of migrants losing their jobs. But it quickly recovered as exports revived and stimulus measures helped spur growth. Now coastal factories are back to hand-wringing about a shortage of labour, notwithstanding the dark shadow cast by Europe's misfortunes.

But recent changes in migration patterns, though they are only just beginning, may be more than temporary distortions caused by troubled Western markets. They reflect China's evolving economy and its ageing population. Even deep in the interior, the days of an abundant and apparently endless supply of cheap, young labour are over. The number of 15- to 29-year-olds peaked last year, according to UN estimates, and the working-age population as a whole will begin to decline in a few years. More than 90% of people under 30 from rural areas are already engaged in non-agricultural work, according to a report last year by the Development Research Centre, a government think-tank. So pressed are some businesses in Chongqing and Sichuan for semi-skilled labour that officials this year helped companies from the two regions to visit other provinces in search of workers.

The shift in migration patterns may also reflect a rebalancing of China's economy. Domestic demand has made a bigger contribution to China's growth in recent years, driven by heavy investment in infrastructure and property. To serve this expanding internal market, firms do not need to nestle close to a port. The result is a fast-narrowing wage gap between the coast and the interior. In 2004 coastal wages for migrant labourers were 15% higher than inland, according to a survey by the National Bureau of Statistics. Now, many workers in Sichuan say that taking into account transport costs and higher living expenses on the coast, less well-paid jobs closer to home are beginning to look much more competitive.

Experiments are under way in Chengdu and its environs, as well as in Chongqing, aimed at making it easier for migrants in urban areas to enjoy the same welfare benefits as registered city-dwellers. Lack of access to such benefits, particularly to urban schools, subsidised housing and health care, is a big problem for migrants. Many leave their children behind in their villages to be looked after (often not very attentively) by grandparents or other relatives.

Between August 2010 and December last year, Chongqing awarded full urban-welfare rights to 3m migrants from its rural hinterland who had lived for a certain period in urban areas. Chengdu plans to eliminate welfare-related barriers to migration within the city boundary by the end of this year. This will mean that Fuxing's farmers will be able to migrate to the city proper and enjoy the same benefits as were once enjoyed only by holders of urban hukou, or household-registration papers. The farmers will also be allowed to keep their land-use rights in the countryside. The reforms impose a big financial burden on local governments, but for the moment Chongqing and Chengdu—buoyed by a surge of government-led investment—are enjoying the kind of boom that was once confined largely to the coast. Chengdu boasted 15.2% growth in 2011, while Chongqing says its GDP grew 16.4%, faster than almost every other provincial area. The shift will create new problems even as it solves others, but it heralds a change of huge consequence for China's hitherto unbalanced development.