Nairobi - For the past year, many celebrated that Somalia's Shabaab fighters were on the back foot, as African Union and government forces wrested town after town from the Al-Qaeda-linked gunmen.
But despite recent infighting - including the recent killing of top leaders in a bloody purge - analysts warn the extremist group are far from defeated.
A brazen daylight attack last month on a fortified United Nations compound in Mogadishu, with a seven-man suicide commando blasting into the complex and killing 11 in a gun battle to the death, followed similar tactics used in an attack on a court house in April.
"Despite significant infighting, al-Saebaab stepped up attacks... shaking the fragile sense of security in the capital by launching attacks," the International Crisis Group (ICG) notes.
The complex attacks came even as top Shabaab leader Ahmed Abdi Godane moved against fellow commanders who had criticised his leadership, killing two co-founders of the Islamist group.
Those included US-wanted Ibrahim Haji Jama Mead, better known by his nickname Al-Afghani - or "the Afghan" - due to his training and fighting with Islamist guerrillas there.
Afghani was a commander "highly popular with al-Qaeda", notes Stig Jarle Hansen, from Norway's University of Life Sciences and author of a book on the Shebaab.
The deaths show the splits in the long-running insurgency to topple the internationally-backed government - defended by 17 700 AU troops - but also signal Godane's efforts to sweep away opposition to his command and cement his more radical leadership.
Afghani was killed after he reportedly penned a letter circulated on extremist websites to al-Qaeda leader Ayman al-Zawahiri, criticising Godane's leadership.
Afghani's killing is "very important", added Hansen, noting that Godane - with a $7m bounty on his head - faces tough challenges to lead the fractured and decentralised forces, and maintain the loyalty of veteran commanders.
"One scenario if Godane fails [to unite forces] is that the Shabaab turns into something like the [Ugandan-led rebel] Lord's Resistance Army...an organisation based around terror and the charisma of the leader," Hansen told AFP.
"It can remain a shadow structure that is to be reckoned with also inside Kenya and Tanzania."
There are concerns Godane's elimination of commanders with more nationalist agendas could see a rise in attacks such as the assault on the UN compound, tactics more commonly seen in Afghanistan.
How al-Qaeda's "central" leadership will react to Godane's purges will also be important, Hansen added.
Veteran Islamist leader Hassan Dahir Aweys, allied to the Shabaab since 2010, also fled Godane's purge after criticising his rule, and has since been placed under arrest in the capital Mogadishu.
"His capture does not spell the end for Al-Shebaab," wrote Somali analyst Abdihakim Ainte for the African Arguments site, hosted by Britain's Royal African Society.
"Quite the contrary, it may encourage hardliners to stage more deadly assaults in order to counter the view that al-Shabaab is on the back foot."
The influential cleric and former army colonel is on both US and UN Security Council terrorism sanctions lists.
But Aweys has long been critical of Godane and while his arrest is significant, the impact on the Shebaab's operational capacity is less important.
Yet divisions amongst Somalia's national army, cobbled together out of multiple militia forces, continue to be exploited by the Shebaab.
Mogadishu's government is also struggling to impose authority over autonomous regions unused to central control after two decades of war.
"Despite progress... al-Shebaab still remains the primary threat to the survival of the new Somali government", South Africa's Institute for Security Studies (ISS) warned in a recent report, adding that while it may not be in control but it could "make the country ungovernable".
Cash flows have dried up but funds are still raised inside Somalia through local taxes.
Key strongholds remaining include rural southern and central Somalia, while another faction has dug into remote and rugged mountains in the northern Puntland region.
Still, the force is believed to be less capable of carrying out the major regional attacks as it did in the 2010 bombings in Uganda, killing 74 as people watched the World Cup.
"We believe they are now more focused internally on Somalia and lack the capability for regional attacks, but we remain ever watchful," said one Western security expert.
"But in terms of defeat inside Somalia, we must be careful not to confuse the victory symbol of raising flags in the centre of towns with the harder task of establishing control."