THE Atlantic crossings made by Europeans to America in the late 19th and early 20th centuries were one of the great migrations in history. Much less noticed was the flood of people into Spain in the first decade of the 21st.

Spain absorbed an extra 5m immigrants between 2000 and 2009. By the latter date, the proportion of immigrants in the population was 13.8%, not far short of the proportion in the United States in around 1900. The country is now dealing with the aftermath of that remarkable shift. Many of those immigrants worked in the construction industry, which has collapsed since. With jobs now scarce, the flow has turned from net immigration to net emigration: Spain’s population fell by more tan 200,000 last year.

In an ideal world, indeed in an ideal currency union, labour would flow to where it is most needed. Unemployment in Spain is high; in Germany it is relatively low. Some young Spaniards are moving to Germany in search of work. Nearly 30,000 made the trip in 2012. Yet these are fairly small numbers.

More Greeks than Spaniards moved to Germany in 2012, even though Greece’s population is only a quarter of the size of Spain’s. Romania, with only half as many people as Spain, supplied Germany with 116,000 immigrants. Poland, which has four-fifths as many, sent 176,000 migrants across the German border.

The main cause of Spain’s population fall in 2012 was that former immigrants moved on, either back to their own countries or to other EU nations in search of work. Just three countriesColombia, Ecuador and Romaniaaccounted for almost half of the leavers.

Language may be the key factor: five of the largest 15 immigrant populations in Spain came from Spanish-speaking countries in Latin America. Perhaps the global Hispanic labour market is more efficient than the EU version. Sincé there are no other Spanish-speaking countries in the EU, young Spaniards seeking a better-paid job must have some language skills. In Madrid and Barcelona there has been a 60% jump in the number of young Spaniards seeking to learn German. Of course, for plenty of manual jobs, no language skills are necessary. But Spaniards would then have to compete against workers from eastern Europe or elsewhere, who are willing to accept low wages.

It might seem surprising that the number of young Spaniards willing to take this risk is not higher, given youth unemployment of 56%. But Carmen González Enríquez, an economist at the Real Instituto Elcano, argues this figure is overstated. Of the 4.1m Spaniards aged between 16 and 24, only 1.7m are in a job or looking for work.

The vast majority of the rest are either students or young mothers looking after babies. So the number of young Spaniards who are unemployed is actually 22%still far too high, but not quite as alarming as the number usually quoted.

What would happen if more young Spaniards moved within the EU in search of work? Would that be good for the Spanish economy in the long run? Because of its low fertility rate in recent decades, Spain is ageing rapidly. Having had 5.6 people of working age for every retired person in 1970, Spain has just 3.6 today. By 2050, the ratio will have deteriorated to 1.5, according to the OECD.

Public expenditure on pensions is expected to rise from around 9% of GDP today to 15.5% by 2050. Those numbers may look a lot worse if young Spaniards emigrate in droves, leaving fewer workers to care for the remaining elderly.

A further danger, according to William Chislett, a commentator based in Spain, is that those who go are the brightest and most qualified, leaving behind people who dropped out of school at the age of 16 because of the chance to earn a good wage on building sites. Although foreign companies are recruiting skilled workers in the car industry, finding jobs for the large number of unqualified workers is proving difficult.

What is not clear is whether Spain has the regulatory climate that will nurture the new companies the country needs to provide work for its young people. A World Bank survey last year ranked the country 136th in the world in terms of ease of starting a business, sandwiched between Brunei and the Dominican Republic.

America in the early 20th century was a land of opportunity; that was why immigrants arrived and why they helped the economy to flourish. Spain needs the same spirit, so that the best and brightest of its population—born at home or abroadcan become the next generation of entrepreneurs.