"Shabaab is a sophisticated militia," says Inspector Tariye Ogbise from the Nigerian contingent supervising the night patrol. "The Somali police force cannot stand alone, we are here to support them."

Two hours later a suicide bomber detonates an explosive vest in the area, killing one police officer.

Since 2006, Somalia has been in the grip of a brutal insurgency led by al-Shabaab. With the establishment of a new government and significant victories over al-Shabaab in the past 18 months, a sense of calm pervades Mogadishu's streets. The city's shattered buildings, with heavy shades of Italian and Arabic architecture, are being repaired, business is booming and people are back at

the beaches.

Advertisement

Yet Islamic extremists are far from defeated, remaining in control of large swathes of countryside and capable of attacking deep into territory apparently under government control.

The effort to reclaim Somalia from insurgents is a messy affair: the lines between the government and the insurgents are blurred.

All parties have committed abuses.

The African Union's 17,600 peacekeepers (known as Amisom) are stretched to capacity, holding only the main towns.

The counter-insurgency has been a crude matter and Amisom suffers a trust deficit. The most informed estimates believe just over half the population support it. Indiscriminate shelling, particularly by Kenyan and Ethiopian troops in south-central Somalia, has fuelled the distrust, along with Somalis' traditional hostility to outsiders.

The government's forces also act with impunity, according to rights groups, and are unable to secure and police areas under their control. Rapes by government forces of women in displaced persons camps have been documented, as have arbitrary arrests and intimidation of journalists seen as critical of the government. And with a slew of al-Shabaab defectors drawn into the national army, many view the government with suspicion.

"How can we trust the government?" says Sheikh Mohammed Abdulghadr, spokesman for the government-allied Sufi militia, Ahlu Sunna Waljama'a. "We received information that there would be an attack and passed this on to the government. Nothing was done."

That attack was the most serious suicide bombing in Mogadishu this year. An al-Shabaab bomber drove alongside the Somali intelligence chief's convoy on a busy road.

As the bomber drew level with the chief's vehicle - suggesting insider information - he detonated the explosives. A minibus carrying civilians was engulfed in flames, a cafe ruined. Ten people were killed.

There is little doubt that shifting alliances have allowed al-Shabaab to infiltrate Somalia's security apparatus.

For William Reno, an expert in African militia and a professor at Northwestern University in the US, this blurring between government and rebel factions makes it difficult to establish a "government that is committed to real and sustained reform in areas under its control".

Al-Shabaab emerged as a potent force following the Ethiopian invasion of Somalia in 2006. An alliance of religious figures and businessmen had established a system of rule - the Union of Islamic Courts (UIC) - which had stabilised the country after 15 years of internecine clan warfare following the fall of Siad Barre's regime in 1991.

The UIC was unacceptable to Western powers and the US agitated for an Ethiopian intervention, which quickly overwhelmed the UIC militia. But the UIC's youth wing - al-Shabaab - led by Sheikh Aden Ayro, who received explosives and insurgency training in Afghanistan in the 1990s, emerged as a ferocious force.

Shabaab's fighters were mostly young men and boys who grew up among lawlessness and violence. And it was vicious: stoning rape victims, beheading its opposition, cutting down scores of civilians in indiscriminate suicide attacks and enforcing an austere version of Islam.

"If Shabaab finds me, they will cut off my head," says 16-year-old Abdel Nasr, from Middle Shabelle, Somalia's breadbasket. He was recruited from a religious school by al-Shabaab when he was 14. He defected six months ago, and has been drawn into a government training program for military service.

"We believe that if we train them, we can cleanse all the things Shabaab put in their heads," his supervisor says.

There is no discernible exit strategy for Amisom.

An exhausted Nigerian lieutenant, who gives only the name Gideon, leans against a mine-resistant truck.

"I'll stay as long as my government tells me to," he says. "We have some problems in my country, but our security can deal with them.