Al-Shabaab: The key to support of Islamist rebels was their navigation of Somalia's competing complex of clans

Ultimate defeat militants will only come with a comprehensive political settlement for war-torn country

Amid the recent talk of defeating al-Shabaab it's worth remembering where and how the militant outfit was born.

In 2005 a few dozen Somalis declared themselves to be the youth wing of a new Islamic Courts movement that was becoming influential in a country ravaged by warlords and their battling militias.

Shabaab (Arabic for “youth”) emerged as the dominant force within the courts as they took control of the capital Mogadishu imposing some order on what had become the world's most failed state. The Islamic authority was rolled back in 2006 by foreign powers as the United States backed an invasion of Somalia by its neighbours Ethiopia.

Far from a defeat, al-Shabaab emerged as a national force during the occupation and took control of half the country after the Ethiopians retreated. They held sway despite imposing a form of Islam largely alien to most Somalis, which included bans on music and sport, heavy restrictions on women and atrocities against Sufi Muslims.

The key to their support was their astute navigation of Somalia's competing complex of clans.

The militants were eventually driven out of the capital by African Union forces in 2011 and then out of their last major urban stronghold in the port city of Kismayo last year. But it has been a campaign of containment, not eradication. The radicals still hold sway over the parts of southern and central Somalia which are not occupied by foreign armies.

As Somalia now fumbles for a federal solution that will award separate fiefs to its most powerful clans with an undetermined central authority in the capital, al-Shabaab remains a useful tool to those unhappy with the deal they are getting.

Many of the the militant group's remaining fighters, also serve in clan militias or the Somali security forces. Outside the bullet-ridden UN compound two of the dead Shabaab fighters who lay on the ground were wearing army uniforms. 

That may have been a stolen uniform used as a disguise but it may just as well have been the uniform the dead man was wearing in his second job the day before. The military solution has contained al-Shabaab but its ultimate defeat will only come with a comprehensive political settlement for Somalia.