A suicide bomber blew himself up at a military academy in the western part of Somalia's capital, killing at least five soldiers, said a military officer.
Two military colonels were among those died as well as the camp's chief trainer, said Col. Abdi Hassan.
The bomber dressed in a military uniform walked into the Somali military training camp on Monday morning and detonated explosives strapped to his waist near soldiers and officers, said Hassan.
The bomber, posing as a military trainee, had crossed the gate checkpoint and targeted soldiers and officers resting under a tree after their daily military exercises, he said.
Somalia's Islamic extremist rebels, al-Shabab, have claimed responsibility for the attack.