Heavy fighting erupted on Monday in the Somali border town of Balad Hawo near Kenya after al-Shabab detonated a suicide car bomb and then stormed the military base there, the spokesman of the al-Qaeda-linked group told Reuters news agency.

Al-Shabab, which wants to impose its strict interpretation of Islam in Somalia, has carried out frequent past attacks in Mogadishu and elsewhere in its bid to topple the Western-backed government and drive out African Union troops.

"First, a mujahid with a car bomb rammed into the military base and then we stormed it," the spokesman, Abdiasis Abu Musab, said.

The group also said 24 Somali soldiers were killed in the raid, but a Somali military official put the figure at about 10 dead soldiers.

READ MORE: Somalia leader declares country a 'war zone'

"We were awoken by a suicide car bomb this morning and then, fierce battle followed," Major Mohamed Abdullahi told Reuters news agency from the town.

"We lost at least 10 soldiers. We chased al-Shabab out of the town. We killed seven militants," Abdullahi said. The death toll on both sides could still rise, however, he added.

Residents said the fighting was continuing.

"First, we heard a huge blast at the military base and then, heavy exchange of gunfire followed," Suleiman Nur, a shopkeeper in the town, told Reuters.

"Al-Shabab captured the military base, the police station and most part of the town," he added. "But still we hear heavy exchange of gunfire on the far side of town. I could see two military vehicles taken by al-Shabab."

Somalia has been at war since 1991, when clan-based militias overthrew long-time leader Siad Barre and then turned on each other.