NAIROBI (AFP) – The massacre at a Kenyan shopping mall by Somalia's Shebab insurgents has shown the still potent threat of the Al-Qaeda-linked group even as fighters struggle at home, analysts say.
The attack, which follows bloody strikes by Shebab suicide commandos earlier this year, including against an United Nations base in the Somali capital Mogadishu, comes in spite of the group losing a string of key towns in Somalia to African Union troops and bitter infighting.
Dramatic attacks such as Saturday's brutal siege in Nairobi's Westgate shopping centre can be seen as an attempt to bolster their struggling reputation and loss of territory at home, experts say.
"Paradoxically, a weakened Shebab is a greater threat outside Somalia than a stronger Shebab," wrote Ken Menkhaus, professor at Davidson College in the US state of North Carolina, in an article following the attack.
He noted that he had previously argued that "were the group to weaken and fragment, it would be more likely to consider high-risk terrorism abroad."
Shebab chief Ahmed Godane, who the US have offered $7 million for, is seeking to strengthen his authoritarian control following bloody purges of former comrades after they complained to Al-Qaeda leader Ayman al-Zawahiri about his command.
"The group has been going through its own internal struggles over its leadership and direction," said J. Peter Pham, who heads the Africa Center at the Atlantic Council in Washington.
"The question now is whether, having marginalised rivals and turned Shebab into more of a terrorist group and less of a Somali insurgency, Godane will transform it into a more regional threat."
Before Westgate, the group's last large scale attack outside Somalia was its 2010 bombing of the Ugandan capital Kampala, in which at least 76 died.
In recent years, the extremist group has instead struggled inside Somalia, tied down battling regional armies such as Ethiopia and Kenya, as well as the African Union force (AMISOM).
Shebab fighters fled fixed positions in the capital Mogadishu, and have since lost almost all its towns to AMISOM forces.
"The Westgate attack is the latest sign of the group's weakness. It was a desperate, high-risk gamble by Shebab to reverse its prospects," Menkhaus argued.
The major attack on Nairobi comes almost two years after Kenya rolled troops and tanks across the border to fight the Islamists on their home ground in southern Somalia, seizing the Shebab's former bastion port of Kismayo.
Since then the Shebab have multiplied their warnings of revenge attacks on Kenyan soil, but until now were on a relatively small scale, at least in the capital.
"The group is just now recovering its elan from the loss of territorial dominance it formerly enjoyed before the AMISOM and Kenyan-led offensives of 2011 and 2012," Pham added.
Still, Shebab fighters control swathes of rural southern Somalia, while UN Monitoring Group reports in July estimated the Shebab are still some 5,000 strong, and remain the "principal threat to peace and security in Somalia".
Their threat, as the well-planned attack in Nairobi showed, should not be underestimated.
In June, the Shebab showed their strength with a brazen daylight attack on a fortified United Nations compound in Mogadishu, with a seven-man suicide commando blasting into the complex and starting a gun battle to the death.
The coordinated attack on the UN killed 11, tactics already tried in April when they attacked a Mogadishu court house.
Stig Jarle Hansen, a Norwegian academic and author of Al-Shebab in Somalia, warns that Saturday's attack -- as well as the UN and courthouse attacks in Mogadishu -- bore similarities to the 2008 Mumbai terror attacks.
"By making the attack so visible it will hit Kenya where it hurts the most by hitting the tourism sector. I think it very likely that this was calculated. Travel warnings might be issued by western countries as well," said.
"Kenya managed to survive the financial crisis quite well but this will hit them."