Parliament has enshrined in law a ban on the controversial use of the ballot box to decide on applications for Swiss citizenship.
The rightwing Swiss People's Party has forced a nationwide vote on the issue, likely to take place next year.
The Senate finally followed the House of Representatives on Wednesday in approving a proposal that only an elected body or a local assembly must deal with citizenship requests.
The decision came after several rounds of debate in parliament over the past few years and effectively confirms a 2003 Federal Court ruling.
It is a counter-proposal to an initiative by the People's Party, which wants to allow local authorities to give voters the final say on citizenship applications.
A majority of senators had previously been in favour of allowing ballots under certain conditions, but the Senate decided finally to align itself with the House for tactical reasons.
The centre-right Christian Democrat Hansheiri Inderkum said that if parliament proposed a solution too close to that of the initiative, voters would most likely follow the People's Party instead – an outcome most parliamentarians want to avoid.
Ballot box procedures have been subject to heated criticism and media attention, notably when voters in the town of Emmen near Lucerne repeatedly rejected the naturalisation of foreigners, especially those from the Balkans.
A 2005 study also showed that foreigners have less chance of obtaining a Swiss passport if voters decide on citizenship applications at the ballot box.
The People's Party launched its initiative after the Federal Court decision, demanding that communes decide themselves how they approve naturalisation requests. The proposal also rules any right of appeal.
Both chambers of parliament have rejected the initiative, calling on citizens to cast a "no" ballot. A vote will most likely take place in June.
The Senate decision means that Switzerland's new naturalisation law is now accepted by a majority of federal politicians.
Foreigners requesting Swiss citizenship will have to accept that some personal data is passed on to communal assemblies. This will include information about their nationality, time of residence in Switzerland and their degree of integration.
Religious beliefs, considered to be part of the private sphere, will not be communicated.
Other elements requested by parliamentarians further to the right, such as whether a person is a social security beneficiary, taxation levels, debts or disability were not included in the legislation.
If a demand is rejected, the decision will have to be justified in writing. Candidates who are turned away will also be able to appeal to the cantonal authorities.
An appeal to the Federal Court will only be allowed if a constitutional right has been violated. A right to appeal against a naturalisation, proposed by the People's Party, was not included in the legislation.
The upcoming vote promises a heated debate, even though the initiative barely gathered enough signatures to be approved. In 2004, Swiss voters rejected simplified naturalisation procedures for second- and third-generation foreigners.
In Switzerland, foreign residents must often wait 12 years before being eligible to apply for citizenship, compared with between four and ten years in EU states.
In most EU countries it is easier for children born to foreign residents to become naturalised than it is in Switzerland. And most citizenship decisions are taken at the town council level, which sets Switzerland apart from the rest of Europe.
In 2006, just over 47,600 applications were accepted – the highest number in 25 years according to the Federal Migration Office. There are 1.5 million foreigners currently living in Switzerland, out of a total population of 7.5 million people.
swissinfo with agencies
The foreign vote
Foreigners don't always need a Swiss passport to have their say in local affairs in Switzerland.
Those who have been resident for a certain number of years are entitled to vote in local elections in cantons Neuchâtel, Jura, Fribourg, Vaud and Geneva.
In Neuchâtel and Jura they can also vote on cantonal issues. In Neuchâtel, Fribourg and Vaud foreigners can also stand in local communal elections.
The situation is very different in German-speaking Switzerland, where only a handful of communes in Appenzell Outer Rhodes, Basel City and Graubünden allow foreigners to vote.
In European Union countries, the 1992 Maastricht Treaty granted citizens from other EU states the right to vote and run for office in local and European elections.
In national law, the situation regarding non-EU citizens varies from one country to another. Some EU states, including Portugal, grant voting rights to citizens of other countries, but only if such rights are reciprocated.