Four civilians and a soldier were killed when heavily-armed Somali militants attacked an army base north of the capital, military sources and witnesses said on Thursday.
Witnesses said dozens of Al-Shabaab members, arriving aboard four pickup trucks, took part in the attack late Wednesday on Hilweyne base 25 km (15 miles) north of Mogadishu, while a soldier said there had been hundreds of assailants.
The militants, whose organization is affiliated to Al-Qaeda, took over the camp for a while before pulling out.
"After (a) tactical retreat by the armed forces, the military is back to the camp now and the situation is under control," said Mohamed Salad, a Somali military commander in the nearby town of Balcad.
"We have lost one soldier in the fighting, but the terrorists also killed four other civilians including two women who were running small businesses near the camp."
Hussein Luqman, a witness, said: "There was heavy exchange of gunfire which continued for more than 30 minutes.
"The Shabab fighters... stormed the base after attacking from several directions using technicals," Luqman said, referring to pickup trucks.