In the past decade, Somali Islamist group Al-Shabaab has lost territory, suffered defections and faced mounting US air strikes, but analysts say the group is as strong a threat as ever, flourishing under the country's weak government.
Despite years of costly efforts to combat the group, Al-Shabaab managed once again to detonate a vehicle packed with explosives in Mogadishu, slaughtering 81 people on Saturday in one of the deadliest attacks of the decade.
"The real hallmark of Al-Shabaab is its resilience," said Matt Bryden, director of Nairobi-based think tank Sahan.
"Leaders of the movement have been killed in drone strikes and commando raids, several master bombmakers have been killed and yet Al-Shabaab continues to wage conventional and guerilla warfare against enemy forces, build bombs, and build an effective underground financial and administrative infrastructure."
Bryden said the Al-Qaeda affiliate's ability to inflict mass casualties in Somalia and elsewhere in the region highlights the fragility of a central government mired in feuds and more focused on staying in power than fighting the Islamists.
At the start of this decade, Al-Shabaab was at its zenith.
It controlled major urban centres including parts of Mogadishu while the internationally-backed government clung to a sliver of territory in the capital.
Somalia had plunged into chaos after the 1991 overthrow of president Siad Barre's military regime led to famine and decades of anarchic clan warfare.
Al-Shabaab emerged from the youth wing of the Islamic Courts Union, a rival to the internationally-backed government established in 2004, which briefly controlled large parts of Somalia.
But in the second half of 2011 the group's fortunes appeared to be waning, as African Union peacekeeping force AMISOM pushed them out of their last bastions in Mogadishu.
Since then they have had to abandon most of their strongholds -- but they still control vast rural areas and have maintained a presence in urban centres through an extensive intelligence network.
"They win support through co-option or coercion. They have a steady supply of finances through a network of taxation and extortion," Murithi Mutiga, a Horn of Africa expert with the International Crisis Group (ICG) think tank, told AFP.
A report by a UN expert panel in November said the group's "mafia-style" taxation system allowed it to generate revenue even in areas it does not control, such as Mogadishu port.
In a sign of its capacity to infiltrate government institutions, a female suicide bomber who blew herself up in government offices in Mogadishu in July, killing the city's mayor, turned out to have been an employee working under false identity, their report said.
The militants have also turned to making home-made explosives and some of their deadliest attacks have been in recent years, such as the 2017 Mogadishu truck bombing which left 512 dead.
Al-Shabaab has also managed to expand its network in the region, especially in Kenya which has suffered several devastating attacks in retaliation for it sending troops into Somalia in 2011.
Most recently in January 2019, 21 people were killed in a siege on an upscale Nairobi hotel, notably carried out by Kenyan-born Shabaab operatives.
Shabaab not government priority
Since the main AMISOM offensive ended in 2015, control of territory has largely remained stagnant.
Mutiga said one of the biggest mistakes that had been made in the fight against Al-Shabaab was that they were often ousted from villages without "a viable plan for what would come next."
And with roughly 20,000 African Union peacekeepers set to leave in 2021, analysts say the ragtag national army is nowhere near ready, with a piecemeal approach seeing Britain, Turkey and the EU holding their own separate training programmes.
"We see no coherent security force emerging that can credibly challenge Shabaab, especially if AU troops pull out," said Bryden.
However he said the main hurdle to fighting Al-Shabaab was that it was not a priority of the central government.
Rather Mogadishu has engaged in political feuds with federal states, focused on gaining control in regional administrations in a bid to boost their chances for re-election with parliamentary polls due in 2020 and a presidential vote in 2021.
"The Somalis are fighting this war with one hand and maybe one foot tied behind their backs," said Bryden.
He said more police and national army resources were currently deployed to secure an electoral process in the central region of Galmudug than to offensive operations against Al-Shabaab.
"That means that the government that is receiving the vast majority of international support and resources to fight Al Shabaab has at best ranked that battle as a second priority."
Somalia's government is officially transitional, as the country still has an incomplete constitution.
Negotiations had been initiated under previous governments on completing the constitution and agreeing the architecture of the country's federation but the present government has halted the talks, said Bryden.
"Somalia can't be ruled only from the centre -- it is too decentralised politically and eonomically. There are too many powerful forces outside Mogadishu," he said.
Despite an increase of US airstrikes under President Donald Trump that have killed more than 800 people since April 2017, observers believe Al-Shabaab will continue to wreak havoc well beyond 2020.
"Al-Shabaab appears to be closing the decade in as strong a position as it has been in in 10 years," said Mutiga.