Public transport companies will have the option to use private security firms to police trains following a decision by parliament.
The Senate on Monday followed the House of Representatives in giving the green light in principle to the proposal, voting to allow the government to set the conditions under which personnel could be armed.
Parliament left it up to the cabinet to decide whether private police can carry guns, not just batons and irritant sprays.
A coalition of four organisations, among them the Swiss Police Federation and Amnesty International, campaigned against the use of private agents on public transport.
"Security is a public task. It should under no circumstances be delegated to poorly trained employees of profit-motivated companies," the coalition said in a statement.
"The safety of millions of travellers will fall victim to business interests," it added.
The cabinet had preferred to limit the use of enforcement methods to batons and irritant substances but the Senate went further, allowing guns on trains in principle.
During the debate, Social Democrat senator Géraldine Savary expressed alarm at the danger of firearms on trains.
"If a situation degenerates in a train, you can imagine the harm that could be caused to people," she warned.
Heinz Buttauer, president of the Swiss Police Federation, told swissinfo that privatisation of the transport police was legally questionable.
"Monday's decision by the Senate is incomprehensible to us and completely wrong. Independent legal experts have confirmed that transport-policing work should exclusively remain the preserve of the police."
Buttauer cited the lack of disciplinary procedures, accountability and the authority to take into custody as problems that would make the security service untenable. "Who will pay when they make a mistake in the line of duty?"
"No private support is needed," he said. "The existing train police play an extremely important role in the internal security of the country. I believe that it is best placed, with some additional recruitment, to carry out this task to the satisfaction of the train users."
Switzerland's second largest rail company BLS told swissinfo it had no plans to use private security companies with armed personnel. "In difficult cases of aggression or violence BLS works with the cantonal police authorities."
BLS confirmed that it already used manpower from private firms to back up its staff during busy operations such as sporting events.
swissinfo contacted Swiss Federal Railways but the company was unavailable for comment.
The Senate placed some restrictions on the security activities of private personnel, tacitly refusing authorisation for them to search passengers, or to provisionally detain those suspected of infringing federal law.
On the question of video surveillance, the Senate agreed to increase the period of footage saved from 24 hours to 100 days.
Access to the footage will be "strictly regulated" to comply with data protection legislation.
The package of legislation, with amendments from the Senate, will now be passed back to the House of Representatives for further discussion.
swissinfo with agencies
The measures approved by parliament come amid increasing violence and acts of vandalism on trains over the past decade.
Trade unions have called for more inspectors, while the Swiss Federal Railways said a staff of 1,900 is sufficient.
The Federal Railways also installed surveillance cameras and launched an awareness campaign in schools to combat violence.
The train operators and the unions disagree over whether the measures led to a decrease in violence.