The army repulsed the attack on the base housing national and local troops in Qayib, a village captured from al-Shabaab last week, defence ministry spokesperson Abdullahi Ali Anod told the state news agency SONNA.
The attack began with two suicide car bombs at around 5 a.m. (0200 GMT), followed by hours of heavy fighting, Ahmed Hassan, a military officer in the nearby town of Bahdo, told Reuters.
"Al-Shabaab torched the telecommunication station of the town, and so it is off the air now. We know we killed five al-Shabaab fighters," Hassan said.
One car bomb hit a military truck guarding the base entrance, while the other was blown up outside, he said.
It wasn't immediately clear how many people had been killed in total, but at least nine soldiers were injured, he said.
In a statement, al-Shabaab spokesperson Abdiasis Abu Musab said the group launched the assault in Qayib using suicide car bombs before its fighters attacked from different directions. The fighters killed several soldiers and stole weapons and military vehicles, Abu Musab said.
Government forces, supported by clan militias, have made a number of battlefield gains against al-Shabaab in the last three months, regaining territory long held by the group.
In response, al-Shabaab killed at least 120 people in twin car bombs at the education ministry in the capital Mogadishu on Oct. 29, the deadliest blasts in five years.
The al Qaeda-linked group has killed tens of thousands of people since 2006 in its fight to overthrow Somalia's Western-backed central government and implement its interpretation of Islamic law.
ZZ/PR