The Greens gained six seats, boosting their representation in the House to 20, while also winning their first position in the 46-member senate, reflecting growing concerns for the environment among Switzerland's electorate.

The Christian Democratic People's Party also made gains of three seats, while the Radicals lost five.

Despite its success, the SVP - led by Chistoph Blocher - lacks an overall majority and will have to govern in a coalition with other parties.

The leaders of the four main parties said they were committed to retaining the system of consensus politics, with cabinet positions shared between the SVP, the Social Democrats, the Radicals and the Christian Democrats.

The four parties have held more than 75% of parliamentary seats for decades.

'Racist' campaign

The SVP's campaign caused deep unease among the large immigrant community, reports the BBC's Imogen Foulkes in Bern.

One single issue dominated the campaign - foreigners.

Twenty percent of Switzerland's population is foreign and the now notorious poster from the SVP, in which three white sheep kick a black sheep out of Switzerland, was widely regarded as racist.

Four political parties have shared power in Switzerland since 1959

But the party insisted the poster was simply an illustration of its campaign to have foreigners who commit crimes deported.

That campaign does seem to have struck a chord with voters.

The SVP will see its big share of the vote as a mandate to push forward policies like the deportation of foreign criminals, and a ban on building minarets, our correspondent says.

It also wants to keep Switzerland out of the European Union.

Opponents fear growing divisions in Swiss society and damage to Switzerland's reputation for consensus and tolerance.