The AU force known as AMISOM said troops regained control of the base in Mogadishu after a gunfight that left five of the attackers dead while three others were captured.
"Three AMISOM soldiers and a civilian contractor unfortunately lost their lives," AMISOM said in a statement, updating earlier information that said the four had been injured in the Christmas Day attack.
The statement did not mention the nationalities of the victims, but a contingent of Ugandan soldiers is in charge of the base.
"AMISOM has regained control of the Halane base camp and restored normalcy. All African Union and United Nations personnel in the base camp are safe and secure," the statement added.
Also Read
The Shebab group quickly claimed responsibility for the attack.
"Our fighters are inside the headquarters of the foreign troops in Somalia," Shebab spokesman Abdulaziz Abu Musab told AFP earlier today, adding that several AU soldiers had been killed.
A Western security source said between 15 and 20 attackers were involved in the assault.
He added on Twitter that the "attackers sneaked in incognito."
Somali police official Abdi Ahmed said loud explosions had resonated at the rear entrance to the Halam base, where exchanges of gunfire were also heard.
The AU force headquarters is a fortified structure located on the grounds of the Mogadishu airport, which is also under high security.
The AMISOM force, deployed since 2007, currently counts some 22,000 African Union troops.