The future of Somalia may very well hinge on its national army. Forming a unified professional force has proven an enormous challenge for the government and an obstacle to peace.
At an African Union training center along the shores of the capital, soldiers from the Somali National Army assemble their weapons.
Sitting on the concrete floor under the watch of a Hungarian military trainer, they are clumsy at first with the sliding mechanisms of the PKM, belt-fed machine guns.
One trainee, Corporal Hassan Osman said he has now got the hang of it. "I know how to handle AK's and PK's," he said, "how to clean them, how to fight with them - all aspects of handling the weaponry."
The AU peacekeeping force AMISOM, working with European military trainers, is taking on the difficult but crucial task of building the capacity of the Somali National Army - the SNA - a force of about 20,000 soldiers desperately lacking in equipment and leadership.
The head of the European Union Training Mission in Somalia, Spanish Colonel Jesus Gonzalez, said a history of war and deep clan divisions in the country makes it difficult to harmonize the force. "This generation grew up during the war, so it's not easy for them and the challenges are there. They have a background of working for a clan, for a militia, but don't have this spirit of unity, of country, yet," he stated.
Gonzalez said military training is, in part about nation-building, and that soldiers here get courses on the constitution and the national anthem, as they are taught to fight for one country.
He said he is seeing signs of improvement. "There is something there that lets me understand that they are willing, that things are changing here, slowly of course, because this is Somalia, but quicker than I thought at the beginning when I arrived here. I see a little progress," Gonzalez said.
When finished with training, these soldiers will return to the frontlines of an ongoing battle with the al-Qaida linked militant group al-Shabab with new skills like weapons handling, bomb detection and first aid.
But a lack of resources remains one of the biggest challenges in the field.
SNA soldiers have worked alongside AMISOM troops in clearing al-Shabab from territory across the country with the intention of securing newly reclaimed towns once operations are complete.
But AMISOM officials say when the fighting is over, often the SNA troops disappear.
While discipline is one problem, AMISOM Force Commander Silas Ntigurirwa said another is that the SNA has not set up appropriate housing for its soldiers in areas of operation. "This is a very big challenge for the Somali National Army. I think they need the military barracks in order to, when they finish the operation they must have somewhere to go. Not for everyone to go back to their own homes," Ntiguriwa stated.
The United Nations monitoring group for Somalia has flagged concerns that weapons being commissioned for the SNA are being diverted along clan lines into the hands of militants and other armed groups operating outside the official security forces.
UN special representative for Somalia Nick Kay said arms diversion is a serious concern for the international community.
He said forming a "truly national Somali army" will take time. "A country that suffered 23 years of state failure, fragmentation of power, a lot of local militia and local clan-based militia have formed and it takes a while, particularly whilst the conflict still continues, to be able to shape a new model army," said Kay.
As AMISOM plans future operations to wrest control of the remaining territories under militant control, the SNA will be vital to re-establishing federal control.
And while AMISOM does not plan to stay in the country forever, its eventual departure will very much depend on a national force being ready to take its place.