Fogh Rasmussen rode to victory on a ticket calling for tighter limits for asylum seekers and refugees, widely viewed as unnecessary beneficiaries of welfare by right-wingers.

The defeat was a stunning blow to Nyrup Rasmussen, 58, who called the snap election in a gamble that voters would unite behind his nine-year leadership after the September 11 attacks on the United States.

He conceded defeat but said that he would continue as leader of his Social Democratic Party.

Fogh Rasmussen's Liberals won 31.2 percent of the vote on Tuesday, up from 24.0 in 1998 and replacing the Social Democrats as Denmark's biggest party for the first time in 80 years. The Social Democrats won 29.3 percent, down from 35.9.

The new prime minister will have to form a government with the Conservatives and centrist parties but will depend on informal backing from the far-right Danish People's Party which is virulently anti-immigrant.

The focus on immigration is a paradox since fewer than five percent of Denmark's 5.3 million population are foreigners. Danes, meanwhile, give more per capita than any other country to developing nations.

Denmark is the second Scandinavian nation after Norway to ditch a Social Democratic government, blamed for a weak welfare state, in an election this year.

The tendency among previously "open" European countries to adopt anti-foreigner stances and make immigration an election issue stirs fears of it becoming a general trend in Europe.

Germany too has its conservative right wing parties playing up the foreigner issue. The infamous "Kinder statt Inder" (Children instead of Indians) election campaign coined by Jürgen Rüttgers of the Christian Democratic Union last year also focused on the German government’s plan to lure more computer specialists from India and other countries.