Switzerland is ending four years' cooperation with the Nato-led International Security and Assistance Force (Isaf) in Afghanistan by recalling its military personnel.
Defence Ministry Samuel Schmid said he had taken the decision for security reasons. Two army officers, currently working with a German team in the northeastern Kunduz province, will return home by March next year.
The Isaf mission had become a peace enforcement operation rather than a peacekeeping duty, Schmid said.
"The Swiss officers haven't been going into the city of Kunduz for months," he told a news conference on Wednesday.
A continued Swiss military presence in Afghanistan – although "rather symbolic" - was impossible because it goes against the spirit of the constitution and is not in line with the law, according to Schmid.
The decision comes a few weeks after a meeting of Nato defence ministers to boost efforts to provide security in Afghanistan.
Switzerland, which is not a member of Nato but joined its Partnership for Peace programme, has participated in Isaf since 2003. Parliament approved the deployment of a contingent of four officers on the basis of a United Nations resolution.
However the nature of Isaf's engagement has changed since 2005. But its mission has progressively turned into a campaign against insurgents, the defence ministry said.
Even in the regions where warlords and fighters only carry out sporadic activity, the mission has faced difficulties because of the need for troops to resort to self-protection measures.
In areas of the country where the Taliban have regained strength, reconstruction work has become practically impossible, the Swiss authorities said.
The local population is bearing the brunt of the worsening security situation in Afghanistan. The International Committee of the Red Cross (ICRC) warned in September that civilians faced increasing hardship in Afghanistan as fighting continued to spread across the country.
The Swiss-run organisation said that large parts of the country were close to becoming "no-go areas" for aid workers.
Reto Stocker, the ICRC's head of delegation in Kabul, said the conflict was "clearly spreading and in certain areas is intensifying".
He said there had been a significant increase in the number of civilian casualties as a result of aerial bombardments and suicide attacks, adding that the conflict was driving more and more people from their homes.
The delivery of basic services such as medical care and education had become "problematic" over wide areas of southern Afghanistan, he added.
Swiss military involvement in Afghanistan is minor compared to Switzerland's humanitarian commitment.
In 2002, Switzerland set up a cooperation office in Kabul aimed at supporting the processes of political stabilisation and reconstruction of the war-torn country.
The office is currently running and supervising a development and humanitarian programme with an annual turnover of up to SFr20 million ($18.1 million).
swissinfo with agencies
In total there are about 250 Swiss peacekeepers and military personnel on international missions abroad.
There are currently about 220 Swiss peacekeepers in Kosovo serving under Austrian command in the Nato-led force.
The others include observers and experts in Bosnia-Herzegovina, the Middle East, Afghanistan, Sudan, Ethiopia, Eritrea, and at the border between North and South Korea.
The 41,000-strong International Security Assistance Force (Isaf) is a Nato mission operating under a UN mandate.
Its role is to assist the Afghan government in extending and exercising its authority and influence across the country, creating the conditions for stabilisation and reconstruction.
There are 38 nations contributing to the international force. Switzerland is the smallest contributing country with two officers.
Neutral Switzerland, although not a member of Nato, is part of its Partnership for Peace programme (PfP).