Islamist insurgents battled for hours on Sunday with African Union troops after exploding two car bombs outside one of their bases, Somali police, military and the militants said.
Al Shabaab militants attacked an African Union (AU) peacekeeper base in the town of Bulamarer, 130 kilometres southwest of the capital Mogadishu, around 9 a.m. local time, residents from the area told Reuters.
Since withdrawing from Mogadishu in 2011, the al Qaeda-linked group has lost control of most of Somalia's cities and towns. But it still retains a strong presence in regions outside the capital.
The militants initially detonated two suicide car bombs that hit one AU vehicle and one Somali military vehicle, Somali army major Farah Osman, who is stationed near the AMISOM (African Union Mission in Somalia) base, said.
"Then a large number of al Shabaab fighters began firing from under the trees ... it was a hellish battle," he said, adding there was an unknown number of casualties.
Militants on foot then attacked nearby villages, said Ali Nur, deputy governor of the Lower Shabelle region where the base is located. "They were repulsed, but all these attacks were to stop reinforcement."
The phone of the spokesman for the AMISOM force based in Mogadishu was switched off on Sunday and Reuters was unable to reach any other officials from the force for comment.
The Ugandan army said in a statement that Ugandan soldiers serving in the AU peacekeeping mission killed 22 al Shabaab militants that had attacked the Bulamarer base and two other posts, all in the Lower Shabelle region. Four Ugandan soldiers were killed, the army said.
Abdiasis Abu Musab, a spokesman for al Shabaab said 14 of the group's fighters and 59 AMISOM troops were killed in the incident.
Nur, the government official, said no soldiers from the Somali army were killed and was not sure if any AMISOM troops were killed.
A police major stationed in a nearby town also said two car bombs exploded outside the base before the al Shabaab fighters entered it.
Major Nur Ali told Reuters that Somali and AMISOM forces had attacked al Shabaab in rural areas near the base on Saturday night. "Then al Shabaab attacked this morning as a revenge," he said.
Somalia has been mired in civil war since 1991.