BERLIN Ata Ucertas, a doctor from Istanbul with a moustache that curls up his cheeks, was welcomed with open arms when he came to Germany this year, evidence of a shift in German attitudes as its population shrinks and labor becomes scarce.
Helped by a shortage of doctors in Germany, the 25-year-old Ucertas was issued with a visa to come learn German within two months of applying. "The immigration officials were really nice to me," he said.
After decades of tending to depict the millions of residents of Turkish origin in Germany as a drag on society, policymakers are now courting foreigners and learning to be more inclusive.
A fifth of residents and a third of school children have a migrant background, making up a growing share of the electorate.
With elections approaching in September, the changing attitudes are reflected in the rhetoric of Chancellor Angela Merkel's conservatives.
A decade ago when unemployment was high and immigration laws strict, Merkel's party campaigned on slogans like "Kinder statt Inder" (Children instead of Indians). Now they are calling for a "welcome culture" towards migrants.
"Germany is making a lot of effort to promote immigration because of the very severe demographic situation which will affect it more than virtually any other OECD country," said OECD migration expert Thomas Liebig.
"The discussion about a welcome culture is part of the whole process of becoming a country for which migration is normal."
With joblessness near its lowest level since the reunification of East and West Germany in 1990, the country faces a shortage of 5.4 million skilled workers by 2025, despite attempts to mobilize women and older people.
Nearly 300,000 people, mainly from the European Union, migrated on a long-term basis to Germany in 2011, OECD data shows, around a third more than in 2010. Most came from the eastern states that joined the EU in 2004, such as Poland.
Germany has long been notorious for its bureaucratic hurdles and an offputting attitude towards economic migration.
The hundreds of thousands of "guest workers" recruited from Italy, Greece, Turkey and other southern states in the 1960s to help it rebuild from the rubble of World War Two were not encouraged to integrate and learn the language, though many did.
Fearing unemployment in the 1970s oil crisis, Germany shut its doors and tried to repatriate the no longer welcome guests.
Influxes of asylum seekers and ethnic Germans from the ex-Soviet Union in the 1990s and the challenges of reunification made Germany even more reluctant to open up. Limits on migration from new EU members in the 2000s lasted longer than elsewhere in the bloc.
"For decades we turned our authorities into a firewall; we told them to keep these people at bay, they only want to get into our social systems," said Peter Clever, a leader of the BDA employers' union. "They were asked not to be that friendly."
But as Germany's job market improved in the 2000s, shortages occurred, and stop-gap measures such as deals to recruit healthcare workers from China and the Philippines were not enough to make up the shortfalls.
Germany has been unwinding its recruitment ban, starting with highly qualified workers and slashing the minimum salary and investment that workers and entrepreneurs needed to immigrate.
This month it jettisoned 40 percent of its immigration rules, lowering barriers for medium-skilled workers in sectors with chronic shortages such as train drivers and electricians.
"This little revolution has gone by largely unnoticed," said the OECD's Liebig. For highly skilled workers Germany now has some of the most liberal immigration laws of the 34 OECD states.
It is tackling the language barrier by setting up new courses abroad and helping people get their qualifications recognized so doctors do not have to work as taxi drivers.
It is recruiting foreigners to study at its universities and for its highly regarded apprenticeships, with a current focus on areas of southern Europe with soaring youth unemployment.
The southern town of Mindelheim, which has a jobless rate of 2.2 percent, effectively full employment, recruited 20-year-old Spaniard Jan Sabater Viñals for a hotel apprenticeship.
"I clearly have a lot more opportunities in Germany than in Spain," he said. "I want to stay three years, maybe more."
Immigration is rising so much that Germany's population grew in 2011 for the first time in nearly a decade. But relative to its population it still attracts only a tenth as many foreign workers as countries like Canada that have traditionally welcomed immigration.
And many of the guest worker generation and their families still feel unwelcome, particularly the non-Europeans.
Baris Yesildag, 26, selling baklava pastries on the Berlin Turkish street market, says he was born in Germany to Turkish parents but had never been accepted as a German: "I did voluntary military service here, but an officer told me I was only doing it for the money and not for Germany."
While the far-right is politically weak, xenophobic views still make it into the mainstream debate in Germany.
A 2010 book by ex-Bundesbanker Thilo Sarrazin slamming Muslims as welfare spongers became a best-seller, emboldening some conservatives to attack migrants for failing to fit in.
Experts say hostility has been fuelled by the low status of the guest workers who struggled to rise up the socio-economic ladder. Many Germans blamed this on their unwillingness to integrate. In reality, a school system that streams pupils from a young age and only teaches for half the day doesn't help guest workers' children learn good German and means may are later stuck in low-skilled jobs.
The United Nations says Germany has been sluggish to tackle discrimination in areas like housing, which have led to migrants living in ghettoized communities. Immigrants are also still underrepresented in public office, the police and media.
Crucially, however, the latest wave of immigrants face fewer obstacles to social inclusion, not least because they are mostly highly educated Europeans who have had language help.
Former Social Democrat Chancellor Gerhard Schroeder started the drive for a more inclusive society with the reform of a bloodline-based citizenship law dating back to 1913 to enable immigrants to get nationality. He also brought in courses to familiarize newcomers with the culture and language.
Merkel has to work harder to win over her conservatives, who are traditionally tougher on immigrants, but her efforts are having a trickle-down effect. A 2006 "Diversity Charter" signed by four private companies now has more than 1,500 signatories.
In a ceremony in Berlin, men and women from as far afield as Nigeria and China, sporting attire from headscarves to African prints, beam as they receive their new citizenship papers.
Among them was Karolina Krolicka, a 22 year old Polish-born law student with a slight accent. She arrived in Germany with her family years ago and wants to stay.
Krolicka swore her allegiance to the German constitution during the ceremony, which culminated in Germany's new citizens rising to sing the national anthem.
"I'm going to celebrate now," she said.
(Additional reporting by Andreas Rinke; Editing by Will Waterman)