The Islamist group al-Shabab, that controls large parts of central and southern Somalia, has recently suffered significant defeats at the hands of Amisom, the African Union force that has been fighting the al-Qaeda-allied militants. The BBC's Gabriel Gatehouse is in Mogadishu and has been travelling with them.
"Every day they attack, but without success," a Burundian soldier says as he takes us to see his new front line, on the outskirts of Mogadishu.
"Shabab, finished!" shouts a new Somali recruit, as he heaves himself into his "technical" - a modified pickup truck with an anti-aircraft gun welded to the back, bullet belts slung around his neck.
African Union forces have been hitting al-Shabab hard.
Together with their allies in the Somali national army (mostly former militiamen like the young fighter in the "technical"), Ugandan and Burundian soldiers took the key town of Afgoye at the end of April.
It is about 30 km (18.5 miles) from Mogadishu, and had been a crucial stronghold for the Islamist fighters, as well as a centre of their bomb-making activities. Almost simultaneously, Kenyan forces have been advancing on the al-Shabab stronghold of Kismayo in the south. And Ethiopian troops are squeezing the Islamists in the west, near the town of Baidoa.
Col Kayanja Muhanga, the Ugandan officer in charge of the assault on Afgoye, says it has been a tough battle. He says he and his men have been aided by a steady trickle of defectors.
"They have had a lot of losses," he says at his camp outside Afgoye.
"And when the enemy is defeated, some of them report to you. They have been giving us very useful information."
We meet a young man by the name of Abu Khalit. He is 24 years old and had deserted from al-Shabab only the previous week.
He says he joined the Islamists four years ago. He would have risked certain death if he had been caught as a defector.
"I realised al-Shabab were not bringing freedom to the people," he said.
"I realised it wasn't about religion. These people just want to fight. The real enemy here is al-Qaeda."
Al-Shabab's recent losses have had an effect on morale.
"They have all fled this area. Their morale has died. Everyone is looking for somewhere to hide." Proxy war?
Over the past 20 years, there have been numerous attempts to bring peace to Somalia by force.
The United States failed, culminating in the now-infamous 1993 incident in the battle for Mogadishu dubbed "Black Hawk Down". Other UN-backed international missions also failed. But this time, Col Muhanga says, it is different.
"This is Africans solving their own problems. Africans solving African problems. The Somalis identify more with us because we are neighbours, we are Africans. They identify more with us than the foreign forces that have been here before."
Col Muhanga's assessment of the situation is accurate, up to a point.
As their armoured convoys rumble through the streets of Mogadishu, reactions from local residents are by and large positive, with waves and cheers from the shops and stalls that have re-emerged in the capital since Amisom pushed out al-Shabab.
But Amisom is almost exclusively financed not by African nations, but by the big Western powers, notably the US and the EU.
Ugandan troops receive training from US forces inside Uganda. In Mogadishu itself, Amisom officers are "mentored" by a group of international private security contractors, mostly from Europe or the US, some of them veterans of decades of African conflicts.
All of this leaves the Amisom mission vulnerable to being labelled a "proxy war".
The AU mission is ultra-low-budget. For example, Amisom does not have a single helicopter, a fact that contributed to heavy losses among Burundian forces during last year's battle for Mogadishu.
The operation costs a fraction of other UN-led peacekeeping missions, for example the UN mission in DR Congo, which is widely seen as ineffectual, not to mention the US-led missions in Iraq and Afghanistan. Shabab nostalgia
So is Amisom a model for future conflict resolution in Africa and elsewhere?
It could be, says Augustine Mahiga, the UN Special Representative to Somalia."[Amisom] has not only delivered, but believe me, it is also cost-effective. It has to be revisited. There has to be re-thinking at the UN."
But despite the military advances, the battle for "hearts and minds" is not yet won.
At Mogadishu seaport, we watch two dozen men unloading bundles and boxes from cargo ships and piling them onto their trucks.
All the drivers said they thought life was better under al-Shabab - less corrupt and more secure, so long as you stayed out of politics.
"In al-Shabab areas, we don't see guns everywhere," said Mahmood Abdullahi.
"If the government disarmed the militias and got rid of the checkpoints that steal money from us, then we would support the government."
Yet it is politics that could make or break Somalia's current momentum towards stability.
There is a hugely complicated political process under way that is supposed to culminate by 20 August this year.
First, a group of clan elders must select a Constituent Assembly. That body must in turn must adopt a new constitution, and nominate members to a new parliament, which will then elect a new president.
The process is fraught with potential pitfalls, not least a number of former warlords who have financial and political interests in maintaining instability.
But Somalia is now closer to establishing some sort of meaningful central government that it has been for more than two decades.
The African Union knows it needs more than just military victories.
The gun has become a way of life. "Africans solving African problems" seems to be working for now.
But in the end, Somalia's patchwork of private militias needs to be integrated into a unified national force - one that will defend the security of the population, not just the interests of the clan.