Known for working in the toughest conditions, MSF has rarely withdrawn completely from a country, only North Korea in recent years and Ethiopia two decades ago.
The agency worked in Afghanistan during the 1979-89 Soviet occupation, during internecine battles among mujahedeen fighters and during the fundamentalist Taliban era of the 1990s.
But nearly three years after the U.S.-led invasion, MSF is leaving, citing sharply deteriorating security, the unresolved deaths of five of its staff in a June ambush and its frustration with U.S.-led forces and North Atlantic Treaty Organization peacekeepers.
"We feel that the framework for independent humanitarian action in Afghanistan at present has simply evaporated," Kenny Gluck, MSF's director of operations, told reporters.
U.S.-led and NATO forces run reconstruction teams of soldiers who provide health care, dig wells and perform other work usually carried out by civilians.
Last weekend, the Canadian Forces civilian-military co-operation unit in Afghanistan celebrated the last of 152 projects conducted over the past six months. The unit worked on projects such as schools, orphanages, bridges and water systems.
Team leader Major Richard Sneddon told The Canadian Press recently that the do-good program is meant to foster good relations with Afghans.
But MSF said the practice blurs the lines between relief work and military operations, placing aid workers in danger of being attacked by insurgents who believe they are part of the military structure.
The agency has complained that U.S. forces were distributing leaflets tying humanitarian aid to the provision of intelligence, suggesting that only Afghans who collaborate will receive help.
"MSF denounces the coalition's attempts to co-opt humanitarian aid and use it to 'win hearts and minds,' " the group's secretary-general, Marine Buissonière, says in a written statement. "By doing so, providing aid is no longer seen as an impartial and neutral act, endangering the lives of humanitarian volunteers and jeopardizing the aid to people in need."
In Ottawa, Foreign Affairs Department spokesman Reynald Doiron suggested that Canadian military efforts to help civilians pose no danger to aid workers.
"We share MSF's concern about the security situation in Afghanistan, and have sought to contribute to stability through the deployment of Canadian peacekeepers."
CARE Canada said attacks on aid workers in Afghanistan rose sharply since 2002, when they ran at about one a month. At least 30 relief and development workers have been killed since March, 2003.
A purported Taliban spokesman claimed responsibility and accused the victims of working for U.S. interests -- a shock to MSF, which says it maintains strict neutrality to protect its workers.
Assis Rahimi, CARE's Ottawa-based Afghanistan program manager, said the "militarization of aid" presents risks for aid organizations.
"Increasingly, people in uniform are building schools, getting involved in needs analysis with communities, and that undermines our mandate and our neutrality because people get confused about who is doing what.
"Do they think we are also military people? This is making life extremely difficult because we can get targeted very easily. . . . We are civilians, we don't carry guns and we are soft targets," Mr. Rahimi said.
He added that CARE, which has about 700 Afghans and six foreign staff in Afghanistan, will remain while assessing the situation.
Emmanuel Isch, who leads the emergency-response team for World Vision, said his agency reduced the scale of some aid programs but does not plan to pull out.
Soon after MSF's announcement, a bomb exploded in a town southwest of the capital, as Afghans lined up at a mosque to register for voting in the Oct. 9 presidential election. Six people were killed, including two UN election workers.
Three rockets fired into Kabul overnight set off a secondary explosion at an Afghan military arms dump and blew a hole in the road in front of the Chinese embassy. No one was injured.