A government military base in Somalia's Lower Shabelle region has been hit by car bombs and gunfire, according to residents and a military officer.
Al-Shabab, an al-Qaeda-linked group fighting to overthrow the country's internationally-recognised government, claimed responsibility for the attack on Wednesday morning.
The military officer told Reuters news agency that the bombs exploded outside the base in Awdheegle, an agricultural district along the Shabelle River, 70km southwest of the capital, Mogadishu.
"The military base is surrounded with heavy sandbags. The two car bombs were fired at and so exploded outside the base," Captain Hussein Ali, a military officer in another town in the same region, told Reuters.
"There are casualties from al-Shabab and government forces but we have no exact figure. Al-Shabab cut off some of the private telecommunications."
Aden Abdullahi, an elder, said: "We heard two huge blasts and gunfire from the direction of the Somali military base. I saw several soldiers running away from the base to escape but we cannot know how many were killed."
Al-Shabab claimed that it had killed 50 soldiers and that two of its fighters had died in the attack.
"Two mujahideen driving two car bombs, one after the other, entered the Somali base in Awdhigle district today. We killed 50 government soldiers and burnt their vehicles," Abdiasis Abu Musab, the group's military operation spokesman, said.
The group and government officials tend to give sharply differing casualty figures for attacks.
A shopkeeper Halima Farah told Reuters from Awdheegle that government troops were in control of the town after the attack. "We have now come out of the houses," Farah told Reuters by phone.
"Today was the worst day for this town."
"We believe both the militants and government suffered great losses of lives today but we cannot see their casualties. Stray bullets killed people in their houses," she added, saying a relative of hers died after being hit in the head.
Last week, Somali government forces had captured most parts of Awdheegle district.
Al-Shabab was forced out of Mogadishu in 2011 and has since lost most of its other strongholds.
However, it continues to be a threat with fighters frequently carrying out bombings in Somalia and neighbouring Kenya, whose troops form part of an African Union-mandated peacekeeping force that helps defend the central government.