Updated

In announcing a pullout from Somalia after 22 years, Doctors Without Borders said Wednesday that armed groups are killing and abducting aid workers. And in a scathing indictment of Somalia's leadership, the aid group accused civilian leaders of condoning or even supporting the attacks.

The pullout goes against the narrative of a Somalia emerging from decades of anarchy and violence amid military gains against Islamist insurgents, but it underscores the violence that persists. Some two dozen local journalists have been killed since the start of 2012. In June, a truck bomb and gunfire attack on the main U.N. compound in Mogadishu killed eight U.N. employees and five Somali civilians.

Doctors Without Borders, the winner of the 1999 Nobel Peace Prize and known by its French initials as MSF, said the pullout will cut off hundreds of thousands of Somali civilians from humanitarian aid. For example, in Mogadishu, MSF runs the only pediatric intensive care unit, while in Jowhar, women will have nowhere to go for emergency Caesarean sections.

The decision comes after the release from prison of a Somali man convicted of killing two MSF staff. In December 2011 a Somali employee of MSF who recently learned his contract would not be renewed shot and killed a Belgian and an Indonesian worker at an MSF compound. Though the shooter was convicted, authorities released him from prison after only a few months.

Since 1991, dozens of attacks resulted in the deaths of 16 Doctors Without Borders staff in Somalia. Two MSF employees who were kidnapped in a Kenyan refugee camp near the border and held in Somalia for almost two years were released last month.

In a blunt statement, MSF denounced "extreme attacks on its staff in an environment where armed groups and civilian leaders increasingly support, tolerate, or condone the killing, assaulting, and abducting of humanitarian aid workers."

"In choosing to kill, attack, and abduct humanitarian aid workers, these armed groups, and the civilian authorities who tolerate their actions, have sealed the fate of countless lives in Somalia," said Dr. Unni Karunakara, MSF's international president.

At a Nairobi press conference he did not elaborate on the accusation or present evidence. Somali government leaders in Mogadishu declined to comment.

Somalia has long been a rudderless nation plagued by cyclical drought and famine and decades of armed conflict. But in recent years it has been seen as making strides in security and governance, particularly since August 2011, when al-Qaida-aligned militants were forced out of Mogadishu.

The security gains brought new measures of freedom to the capital. But violence persists.

"In Somalia we all know we are operating in one of the most volatile and dangerous environments," Philippe Lazzarini, the top U.N. humanitarian official for Somalia, said in a phone interview.

Since the attack on the U.N. compound, the U.N. has scaled back its activities in Mogadishu and is now reassessing the resumption of aid work in the seaside capital.

"We hope we can phase back with a more substantial presence such as the one before," he said.

Karunakara said the "final straw" for MSF was the realization that authorities were actively supporting or tacitly approving attacks against the aid group, even after negotiated access to hard-to-reach communities.

Al-Shabab militants still control much of the country's south. An ultra-conservative Islamist group, it allows very few outside aid groups to operate in its territory.

MSF said it is closing programs in Mogadishu and 10 other locations. The group said it provided more than 624,000 medical consultations, admitted 41,000 patients to hospitals and cared for more than 30,000 malnourished children last year alone.

Lazzarini called MSF's role in Somalia "extremely important" and said the U.N. would look at which of its aid activities could be taken over by other groups. Despite the attack on the U.N. and the MSF pull-out, Lazzarini said Mogadishu is still experiencing a period of hope that should be taken advantage of.

"It's still a high risk environment and challenges are huge," he said. "It's not as stable as people might want for the time being. Still, it's one of those rare times when the international community should beef up its support to the government."