In an interview with Al Jazeera, al-Shabab's military commander Abu Omar was blunt.
"(Our war) is not based on territory lost or gained," he said. "This is ideological warfare. We're fighting for an ideology that transcends geographical or territorial boundaries. We will continue to fight this war until we establish the laws of Allah on Earth."
To the African Union troops who have just succeeded in pushing al-Shabab out of their last remaining stronghold in southern Somalia, that sounds like hubris.
The AU forces – predominantly Kenyans – along with their Somali allies have been advancing on Kismayo since late 2011, slowly squeezing al-Shabab out of the region they've dominated for five years.
Ultra-conservative fighters who once looked more than capable of driving the Somali government into the sea, now controls little more than a handful of isolated towns across southern and central regions of the country.
'Jihad of choice'
In a moment of pride, Kenya's Prime Minister boasted of the "extraordinary achievement of our military men and women" responsible for capturing Kismayo.
There is no denying that it is a significant breakthrough, but in truth, it is more the result of a series of disconnected factors that include the Arab Spring, evolving domestic politics and even the weather.
Al-Shabab's demise began with the revolutions that spread across North Africa early last year.
For years, al-Shabab's struggle in Somalia had been the 'jihad of choice' for militant fighters looking for a cause outside of Afghanistan or Iraq.
Hundreds of ideologically-driven men crossed into Somalia to help topple the western-backed government led by the then-president Sheikh Sharif Ahmed.
It seemed they were joining the winning side. Al Shabab had managed to occupy most of southern and central Somalia, squeezing the government and their African Union defenders into a wedge of territory about a third the size of Mogadishu, and with their backs to the sea.
But when the Arab Spring erupted, the foreign fighters had other more urgent causes to attend to. The uprisings diverted men, money and ammunition. Al-Shabab lost some of their most committed ideologues and fiercest troops.
About the same time, the Ugandan and Burundian forces that made up the vast bulk of the AU mission started to learn how to fight an urban war.
Both came to Somalia with plenty of experience in dealing with insurgencies in the bush, but very little understanding of how to manage one in a big city, crammed with families and businesses and homeless people all struggling to survive. By early last year, and with growing financial support and training from the United Nations, they seemed to work it out, successfully driving al-Shabab from most of Modadishu.
Then the weather played its part.
Last year's drought hit the rural areas of Bay and Bakool particularly hard. Both formed a large part of al-Shabab's heartland, and tens of thousands of people flooded east towards Mogadishu or west into Kenya looking for food. Al-Shabab made things worse by declaring aid agencies to be agents of the occupying forces and refused to let them in.
Hundreds of villages hollowed out.
Farmers abandoned their fields, and men who might otherwise have fought for the rebels went to help their families instead.
More crucially, al-Shabab lost much of the support and goodwill they had built up over the years.
Finally, after no less than 14 failed attempts to produce a legitimate government, the UN managed to usher in an administration with at least a semblance of legitimacy and popular support. It radically changed the political landscape and undercut the reason al-Shabab came to be in the first place (instead of an effective government, clan-based warlords had been tearing the country apart while the rebels managed to produce pockets of stability.)
So, while the Kenyans can rightly claim some responsibility for capturing the rebels' last remaining stronghold, they are also the beneficiaries of historical circumstance.
It also does not mean the war is over.
Ever since the AU advanced out of Mogadishu, al-Shabab has preferred to give up towns rather than stand their ground in the face of overwhelming fire-power. They've consistently described their moves as 'tactical retreats' and promised to wage an 'asymmetrical war' by starting a classic guerrilla conflict.
There's evidence to suggest that they've been planning this for some time. In the town of Marka about 70km south of Mogadishu, AU troops showed us a small but potent weapons cache that locals had revealed. Apart from a collection of AK-47 assault rifles and several boxes of ammunition, the soldiers found a set of four ZU-23 anti-aircraft guns. They had been dismantled, but they were well oiled and in perfect working condition. Whoever hid them clearly planned to return and use them.
The military analysts are right to suggest that it will be incredibly tough for al-Shabab to fight on without a safe and secure base to operate from. And it is hard to see how they could ever regain the power, the influence and the territory they once held.
But after al-Shabab sent three suicide bombers to try to kill Somalia's new president Hassan Sheikh within days of his election, he admitted that the fighters are likely to remain a dangerous force for months and perhaps years to come.