Swiss parliamentarians have voted in favour of a series of measures aimed at tightening the country’s immigration laws.
Under the proposed legislation foreigners from outside the European Union will only be allowed to take up jobs if no Swiss candidates are available.
Despite opposition from the centre-left Social Democrats, the House of Representatives voted in favour of giving priority to EU and European Free Trade Association (Efta) citizens who seek employment in Switzerland.
The proposed two-tier immigration policy is part of a package of measures which will continue to be debated when parliamentarians meet again in June.
This week's special session of parliament focused exclusively on proposals to reform the country's asylum and immigration laws.
The justice minister, Christoph Blocher, said the week-long debate had demonstrated that the polarisation of Left and Right in Swiss politics "continues to exist".
"[This week's debate] ended as it had to end," said Blocher.
Social Democrat Christine Goll said the discussions showed how "isolated" Switzerland was on issues of asylum and migration in Europe.
Hans Fehr of the rightwing Swiss People's Party described the debate as "unsatisfactory".
Some proposals aimed at curbing the number of immigrants were thrown out.
One, supported by the government, sought to restrict immigration from outside the EU to highly skilled labour and people with special qualifications.
Had the proposals been accepted, argued the Social Democrats, Switzerland would have sent a signal to the outside world that the country was promoting an "elitist and discriminatory" immigration policy.
Hans Fehr failed in his bid to convince the House of the need to introduce a quota on the number of foreigners allowed to take up residence in Switzerland.
Foreigners living in Switzerland currently make up 20.1 per cent of the population.
The People's Party was more successful in winning support, albeit by a narrow majority, for a proposal to give foreign workers access to low-paid jobs in the agriculture, tourism and construction sectors.
But the party failed to persuade the House to reintroduce seasonal work permits.
Illegal immigrants may, however, see their chances of staying in Switzerland improved after the House came out in favour of a Social Democratic plan to reassess their status, provided they have lived in the country for more than four years.
That proposal scraped through with a wafer-thin majority of one vote.
During the session the House of Representatives also voted in favour of ratifying a controversial repatriation accord with Nigeria.
The reciprocal agreement - the first of its kind with an African country - means the Swiss authorities can forcibly repatriate Nigerian citizens who do not have the legal right to remain in Switzerland.
The Swiss government came under fire from human rights groups when the treaty was signed last year by the former justice minister, Ruth Metzler.
Earlier this week parliamentarians also voted to crack down on asylum seekers arriving from so-called "safe countries".
A new law - which like all others debated this week also needs Senate approval - will permit cuts in development aid to countries which refuse to take back rejected asylum requests.
But amid the stricter legislation there was one relaxation: a policy of accepting refugees on humanitarian grounds has taken a step closer to becoming law.
swissinfo with agencies
One in five Swiss residents is a foreign national.
One in four workers is a foreign national.
The construction industry and the health sector rely heavily on foreign workers.
Just over half the immigrants in Switzerland come from EU and Efta countries.
In compliance with the JTI standards