Somali government forces have regained control of a town on the border with Kenya after al Shabaab militants stormed an army base there on Monday, causing heavy clashes in which at least 17 people died, the military said.
Islamist insurgents attacked the base at Balad Hawo early in the morning with a car suicide bombing before entering the compound, both sides said.
"We were awoken by a suicide car bomb this morning and then fierce battle followed," Major Mohamed Abdullahi told Reuters from the town.
"We chased al Shabaab out of the town," he said.
Al Shabaab spokesman Abdiasis Abu Musab said the group's fighters left the town after releasing 35 prisoners from the local jail. At least 30 soldiers were killed, he said.
According to the military official, at least 10 soldiers and seven al Shabaab militants were killed, though the death toll on both sides could still rise.
Formed in 2006, Al Shabaab wants to topple the Western-backed government and impose its strict interpretation of Islam. Somalia has been at war since 1991 when clan-based warlords overthrew dictator Siad Barre and then turned on each other.
Al Shabaab carry out frequent attacks on security and government targets, but also on civilians. They also target African Union peacekeeping troops.
Residents confirmed fighting had ended and that the militants had left the town.
"Now Balad Hawo is calm and government forces fully control it," Ahmed Hassan, a resident of the town told Reuters.
Hassan said he saw 13 bodies collected from the military base.