A handout photo taken June 10, 2016, and released by AMISOM shows soldiers serving under the African Union Mission in Somalia (AMISOM) on foot patrol in Halgan village, Hiran region. Civilians in the region have been targeted by recent al-Shabab attacks. AFP
The group has claimed responsibility for the attack at the Hawaadley military facility in Xawaadley village in the Middle Shabelle region, 75 kilometers (about 45 miles) north of Mogadishu.
Somalia's Chief of Defense Forces Gen. Odawa Yusuf Rage said that the attackers were "repulsed by the brave Somali soldiers who were on high alert."
A senior military official, Col. Abshir Shataqey, was among those killed in the attack, Rage said.
Abdi Hassan, a soldier who was at the military camp, told The Associated Press that 12 soldiers were wounded. He said that the military had prior intelligence about the attackers, including their vehicle license plates.
Hassan said the morning attack started with a suicide car bombing at the camp's entrance, and then two other suicide bombs exploded within the camp before a gunbattle ensued.
Somalia's government is leading what is being described as the most significant offensive against al-Shabab in more than a decade.
The group has over the years held back the nation's recovery from decades of conflict by carrying out brazen attacks in Mogadishu, and elsewhere.