Spain has the highest proportion of immigrants of any EU country - most are from Latin America and Eastern Europe. But as boom turns to bust, Spain is rethinking its open-door policy, as the BBC's European Affairs correspondent Oana Lungescu reports.
Madrid airport is the last place many immigrants see in Spain before heading home
With its soaring roof and light-filled spaces, Madrid's Barajas airport is a sign of the good times Spain has enjoyed.
But spend some time in the departure lounge and you can see the signs of the economic downturn.
There is raw emotion at the departure gates. Airlines say 25,000 Latin Americans have bought one-way tickets home.
I met Pilar, from Ecuador, just after she had waved farewell to her sister.
"A lot of my friends and relatives have gone back," she says.
"It's better to be in Ecuador with your loved ones and enough to eat, than here without work."
In the past decade, five million foreign workers have arrived in Spain - making up 10% of the population.
But with unemployment reaching almost 17%, immigrants are now among the first to lose their jobs.
The Spanish government is encouraging them to go back home by offering jobless Latin Americans money in exchange for a promise not to return to Spain for at least three years.
It may sound attractive, but Pilar says not many are interested.
"There's too much bureaucracy. They want to be able to return," she explains.
Spain's authorities confirm that only around 4,000 Latin Americans have taken up the offer.
But now a similar plan is being considered for more than 70,000 unemployed Romanians.
What Spain is trying to do is to take Romanian unemployed out of the Spanish statistics and move them over to the Romanian statistics
President of Alcala's Romanian cultural association
For the first time, an EU country is actively trying to persuade EU citizens from other member states to leave.
I took a train to Alcala de Henares, a medieval city not far from Madrid. It is the birthplace of the writer Cervantes, and is also famous for its cathedral and other historic buildings.
But there is another reason the name of the city is widely known in Spain.
One in 10 people here is from Romania.
Alcala has the biggest Romanian community in Spain, complete with several shops, bars and transport businesses.
In the window of a grocery, the Romanian and Spanish flags are proudly on display, next to a poster advertising the recent European election - in which several Romanians ran on the lists of mainstream Spanish parties.
Inside, the shelves are stacked with Romanian produce, including typical cheese made from sheep's milk, and spicy salami. Every transaction is conducted in Romanian.
At the Hispanic-Romanian centre round the corner, the Spanish language class is well attended, and the students have no plans to go back to Romania.
"Not in the near future," one woman says.
"There's a crisis in Romania too. If we get jobs there, we'll go back, but as it is, we won't." Several people nod their heads vigorously in agreement.
One of the main reasons Romanians were keen to join the EU in 2007 was freedom of movement.
Under EU rules, workers from member countries can travel freely across the continent in search of jobs. It is estimated that more than two million Romanians have travelled to Spain and Italy, whose languages are - like Romanian - rooted in Latin.
Alcala is well-known for its cathedral - and for its big Romanian population
But some are starting to head back.
Didi Subtirel, a broad-shouldered man in a flowery shirt, told me he could not find work in construction any more, and had problems paying his rent.
He came to Spain six years ago after losing his job as a metalworker in central Romania. He saved enough money to build a house in his hometown in Romania, and bring over two of his four sons.
But now Didi is desperate to go back to his wife - and bitterly regrets coming to Spain.
"It was the biggest mistake I have made in my life," he says.
"The most stupid decision possible. If I manage to get some work, I think I'll be home in Romania by Christmas, so I can slaughter the pig and look after my family. That's my hope, God willing."
Spain's tide of migrants may be reversing, but it is a trickle rather than a flood.
In a bar next to a church where an Eastern Orthodox mass is held every Sunday, Gheorghe Gainar, the president of the local Romanian cultural association in Alcala, said many were embarrassed to speak about going back because they thought of it as an admission of failure.
But familiar faces are disappearing.
"We don't see them any more," Mr Gainar explains.
"After mass on Sunday, we usually come to this bar, so we notice if somebody's missing. When I ask where they are, people say they had to leave because they had no more work."
But Mr Gainar is dismissive about the Spanish scheme to offer Romanians money to return.
"What Spain is trying to do is to take Romanian unemployed out of the Spanish statistics and move them over to the Romanian statistics.
"But the Spanish unemployment benefits are higher than a Romanian salary, so it's better for them to stay here in Spain than go home to Romania."
At the Spanish ministry for labour and immigration, the director general, Javier Orduna, is considering various options, including financial contributions from the EU and Romania.
He agrees that unless they are offered help, Romanians simply will not go back. But he denies that the planned return scheme is just an attempt to massage the figures.
Spanish language classes are popular among Romanians
"Of course the crisis affects all of Europe, Romania too," he says.
"But the Romanian unemployment rate is only 5.5%, while in Spain it's nearly 17%.
"We're not trying to shift the statistics so that Spain's employment rate looks better or to get rid of anyone, we're just trying to reorganise the labour market."
No-one knows how many Romanians have gone home. Some who did leave are now back in Spain, or return every three months to collect unemployment benefits. In Alcala, more seem to be planning to stay than to leave.
And, in a Europe without borders, there is little the Spanish government can do to send them packing.