Eye-witnesses said the Shebab had taken over the camp and were looting the weapons stores, but the AU force in Somalia (AMISOM) insisted it was in control of the base.
Witnesses spoke of more than 20 bodies at the site, while the Shebab claimed to have killed 50. AMISOM was unable to confirm any casualty figures.
“The base is still under AMISOM control, reports that the base has been taken over and our weapons captured are false,” an AMISOM statement said without giving further details.
The Shebab said the attack in Janale district, 80 kilometres (50 miles) southwest of Mogadishu in the Lower Shabelle region, was revenge for the killing of seven civilians by Ugandan troops at a wedding in the town of Merka in July.
“The attack started with a suicide bomb explosion and the fighters stormed the base, engaging in fighting that continued inside the military camp for about 40 minutes,” said Shebab spokesman Abdulaziz Abu Musab.
He claimed that “about 50 soldiers” were killed in the attack and that others drowned in a nearby river while fleeing.
“The mujahedeen fighters have taken complete control of the town and the military camp as well and looted all the heavy weaponry,” Abu Musab said. “This attack was aimed to retaliate against the killing of innocent civilians in Merka by the Ugandan troops.”
An AMISOM spokesman said the Janale camp was manned by up to 150 Ugandan soldiers but could not confirm any casualty figures as he was “still waiting details” from the area commander.
Mohamed Shire, a Somali military commander in the area, said there had been “a heavy explosion and fighting.”
Witnesses said Shebab fighters had breached the barricades around the camp.
“Many people stormed the camp after AU soldiers fled, and they started looting together with Al-Shebab,” said local resident Hussein Idris, who said gunmen loaded corpses of AU troops onto trucks.
The Shebab has previously gathered the bodies of dead soldiers for use in propaganda videos of its attacks.
“They were collecting dead bodies, I saw nearly 30 soldiers killed during the fighting,” Idris said.
Another eyewitness, Ahmed Ali, said he had seen AMISOM troops fleeing the base, and had counted as many as 20 bodies.
“The fighters also looted weapons and ammunition,” Ali said.
Another local eyewitness described how a Shebab suicide bomber first attacked the camp gates.
“Heavy fighting broke out after a suicide bomber rammed his vehicle into the camp,” said Ali Moalim Yusuf. “I saw heavily armed fighters chanting ‘Allahu Akbar’ (‘God is greatest’) pouring into the base.”
The Shebab, fighting to overthrow Somalia’s internationally-backed and AU-protected government, has launched a string of similar attacks.