MOGADISHU, Somalia (AP) -- The first Ugandan soldiers to fly into Somalia 5 1/2 years ago came under attack as soon as they arrived: Militants fired mortars at the new mission's welcome ceremony.
Today, backed by a sweeping multinational effort that includes $338 million in U.S. equipment, wages and training, the force of Ugandans, Burundians, Kenyans and Somalis that was deployed to take on the country's Islamic radicals can claim a degree of success that had initially seemed highly unlikely.
When the Ugandan spearhead arrived on March 6, 2007, Somalia had been in chaos for years, ruled by warlords and insurgents bent on creating an Islamic state. AMISOM, the African Union Mission in Somalia, was the most ambitious response since the failed 1990s U.S. intervention of Black-Hawk-Down infamy.
The militants called al-Shabab, who once controlled nearly all of Mogadishu, have been gone from the capital for more than a year, and last month AMISOM booted them out of their last urban stronghold, the port city of Kismayo.
"I think from a military and security perspective it has been a success. Absent AMISOM, al-Shabab would now be in control of Mogadishu. We would not be talking about a new (Somali) national government with a president from civil society in charge," said E.J. Hogendoorn, a Horn of Africa expert at the International Crisis Group, a think tank that tracks conflicts.
But if the specter of Somalia as al-Qaida's next Yemen has been averted, the challenge now is to achieve strong central government for an estimated 10 million Somalis. "What is necessary for the long term in Somalia," said Hogendoorn, "is some sort of political resolution to this conflict."
Somali militants are melting into the local populace and could be preparing a comeback, as happened in Iraq and Afghanistan after invading coalition forces made early claims of success. Al-Shabab still controls wide areas of south-central Somalia.
Their territory, however, is low-value countryside and shrinking, while Mogadishu and other urban areas are enjoying a long-awaited respite from Islamist radicalism.
Some may see AMISOM's success as reaffirming the blueprint of African boots on the ground, backed by U.S., European and U.N. money, as a possible model for the future on this troubled continent.
But Dr. J. Peter Pham, an Africa specialist at the Atlantic Council, a Washington, D.C. think tank, echoes Hogendoorn's caution.
"It's a success for the military strategy, but a military strategy can only achieve military ends ... Victory is secured when Mogadishu faces up to its political crisis. The military can clear out a space but cannot fill a space. That requires civil society and a political solution," he said.
Back in 2007, the first Ugandan troops to arrive barely had enough food. Soldiers actually died of scurvy. An army of bush fighters had been dropped into the most dangerous kind of urban terrain. It lacked - and still lacks - the attack helicopters essential to fighting this kind of war.
Many ingredients went into making AMISOM a credible force: U.S. money, equipment and training; United Nations logistical support, food, housing and an international mandate; training in how to avoid or respond to civilian casualties, an important hearts-and-minds investment.
Another advantage: The invading soldiers, like the Somalis, were black Africans and therefore a more acceptable foreign presence. They were not the first African force policing Somalia - an Ethiopian contingent had been deployed three months before the Ugandans arrived. But Ethiopia, unlike Uganda, moved in with a heavy hand and a poor reputation.
Among the most important factors in AMISOM's success were a high tolerance for casualties, and the incentive of salaries of $1,028 per month, paid for by the European Union - 10 to 20 times the average incomes in Uganda and Burundi.
AMISOM and participating governments refuse to release death tolls. The topic is too politically sensitive back in home capitals. But two Western officials who work on Somalia issues and who were not allowed to be identified told The Associated Press that some 500 Ugandans and Burundians have been killed, plus an unknown number of Kenyans who joined AMISOM over the last year.
That may seem much less than American losses in Iraq and Afghanistan, but proportionate to their troop levels they are high. AMISOM troop levels only recently reached their current peak of 17,000.
"Somalia was the worst situation in the whole world. Somalia was hell on earth, and now it has been turned around. The Somalis now have got hope. So when you ask about the casualties we have taken, I tell you that it was worth it," said Uganda's Gen. Nathan Mugisha, who commanded AMISOM from 2009 to 2011.
AMISOM did not fight in Somalia's pirate-infested region, but with al-Shabab on the run, the government may be able to begin tackling the on-land problems that produced pirates at sea.
Having survived the attack on the welcoming ceremony unscathed, the Ugandan force, then numbering 1,500, soon went to work. It suffered its first fatality in late April, and a week later drove into Mogadishu's Bakara market, with its notorious weapons section called Cirtoogte, meaning "sky shooter," because buyers would test-fire weapons into the air.
It was the first time a foreign military had entered the market in the 15 years since the U.S. forces came and went.
AMISOM's U.N. mandate was narrow: provide security for the airport, seaport and presidential palace. No major battles took place, though mortars hit the airport and targeted killings of troops slowly rose. Al-Shabab seemed more interested in fighting the Ethiopian force.
By the time the Ugandans and the Burundians who had joined them began pushing out from their airport base in 2009, al-Shabab had built a vast network of tunnels and trenches through the city to move supplies and hold back AMISOM's tanks. The Ugandans and Burundians fought building to building, and the civilian casualties often were blamed on AMISOM.
"There was a point when Mogadishu's sentiment was shifting against AMISOM," and the U.S. and its partners decided action was needed, said Hogendoorn.
Troops readying to deploy to Somalia were trained by U.S. and European advisers in firing and maneuvering, fighting in built-up areas, rules of engagement, and making friends in the Somali culture. Somali troops were increasingly integrated into operations.
Capt. Henry Obbo credits those soft military skills with winning the mission. "You can see whenever we move, they wave at us. It's the way we interact with them." Most Ugandans are Christian and Somalis are Muslim, he said, but, "we are all Africans. We have Somalis who are citizens in Uganda. My best friend in school was a Somali called Suliman."
"When they first arrived, we thought that they were an invading force that wanted to colonize Somalia," Abshir Mohamed, a Mogadishu resident, said. "But their actions quickly changed our minds. We saw they didn't have that intention and are doing an ultimate sacrifice for our freedom."
Another Somali, Muhummed Nor, had mixed feelings. AMISOM troops, he said, freed Mogadishu from constant war, but he lamented the number of civilians killed. In his view, AMISOM shelled residential areas. Military leaders blame that shelling on al-Shabab.
After the Ethiopians pulled out in 2009, the U.N. upgraded the mission and AMISOM slowly gained momentum and manpower. Bancroft, a U.S. company hired by the U.S. State Department, introduced sniper rifles and trained 100 marksmen, reducing the need for mortars that could hit civilians. Training sessions back in Uganda incorporated the lessons being learned in Mogadishu.
"Every day they changed and got better," said Richard Rouget, a Frenchman who works for Bancroft. "Better discipline, better battlefield control, better logistics."
The U.S. and Italian governments began paying Somali soldiers' wages, reducing the number of trained government troops who defected to al-Shabab.
AMISOM was gaining ground, and the militants knew it. In August 2010, just before the Muslim holy month of Ramadan, al-Shabab mounted a massive offensive to overrun the government and control all of Mogadishu. Among its ranks were veterans of the Iraq and Afghanistan war, and at least two dozen Americans, mostly of Somali origin.
The militants battled to within 100 meters (yards) of the presidential palace. But they took heavy casualties.
"That was when we broke their back. That marked the beginning of the end of al-Shabab," said Mugisha, the ex-AMISOM commander. "We were supposed to be thrown in the sea. But this was not possible because we were also prepared. There were several battles, very serious and intense. We took some casualties, but I think we won the battles because we had better equipment and we were determined."
Rouget estimated that al-Shabab suffered more than 1,000 dead and wounded, and that the militant commander Mukhtar Robow lost 400 of his men, a blow that began to fracture al-Shabab leadership.
Even after the failed Ramadan offensive, fighting was still intense. In February 2011, AMISOM troops pushed out into southwestern Mogadishu, where the Ministry of Defense was occupied by insurgents. More than 50 AMISOM troops, mostly from Burundi, reportedly died in one day - a figure never officially confirmed.
In May 2011, Ugandan troops fought their way back to Bakara market. Mugisha said that "was the last nail in the coffin of al-Shabab."
"They could not believe that they could be uprooted from that market," he said. "It was a built-up, very formidable area where they had stocked a lot of ammunition, and that's where they sell guns. All sorts of equipment were there. Once they were uprooted out of Bakara and in the northern part of Mogadishu, it marked the major beginning of the end of the whole offensive against al-Shabab."
On Aug. 6, 2011, residents in Mogadishu awoke to find that the militants had fled. The city was free of fighting for the first time in years. Al-Shabab called the pullout a tactical retreat, a way to preserve its dwindling manpower. It was the first of a series of such retreats, culminating in their withdrawal from Kismayo, 415 kilometers (260 miles) southwest of Mogadishu, last month. Kenyan troops launched an overnight amphibious assault on the port city, and al-Shabab announced a pull-out the next day.
"It is an absolutely amazing success," said Bancroft's Rouget. "It's the first time Africa proved it can sort out African conflicts."
Mugisha notes that the U.N. feeds AMISOM's troops, the EU pays them and the U.S. and Italy pay Somali troops. The U.S., though, is the biggest single financial contributor.
"The Americans have supported the training of our troops here, in Uganda and in Burundi, and largely they sponsor it. They give uniforms, body armor and whatever, everything that prepares a soldier for battle," he said. "... Without them I don't think we would have been able to put the soldiers on the ground and sustain them."
The U.S. has equipped AMISOM with ammunition, some rifles, armored personnel carriers, communications gear and small, hand-held surveillance drones called Ravens. They give them boots, uniforms, bulletproof vests and helmets. And U.S. money supports Somali troops with non-lethal equipment.
The U.S. also flies larger drones that occasionally fire at one of al-Shabab's - or al-Qaida's - top leaders.
The U.S. insists AMISOM is not the West's proxy. "AMISOM is an African peacekeeping force responding to an African crisis," says the top U.S. official on Somalia, James Swan. "And like every other peacekeeping operation in the world, it receives a great deal of international support. In the case of AMISOM today, the majority of that support comes from the U.N."
Somali leaders in August voted in a new constitution, a 275-member parliament and a president. Businesses and sports are thriving in Mogadishu under the AMISOM security blanket. Al-Qaida-linked fighters have fled to Yemen and northern Somalia.
But AMISOM leaders know Somalia needs a long-lasting political solution and trustworthy army to escape its two decades of chaos and hold back the warlords.
Brig. Gen. Paul Lokech, the current commander of the Ugandan contingent of AMISOM, attended senior staff college at Fort Leavenworth, Kansas and has "The Leadership Secrets of Colin Powell" on his desk. When asked earlier this year if he trusts Somali politicians, he exhaled loudly.
"Trust? That is too powerful. But these are the elected leaders and we will work with them," he said. He added: "There is need for political actors to come on board and appeal to the fighters to put their arms down. They should be saying, `Brothers, it is high time to end the fighting.'"