Three African Union soldiers and a civilian were injured Thursday after the Shebab staged a brazen attack on the heavily-fortified headquarters of the force in Somalia.
The headquarters, located within the high-security compound of Mogadishu airport which also houses several embassies, was successfully repulsed, the AU force known as AMISOM said.
At least one Shebab fighter, and possibly several others, was said to have been killed after penetrating the compound, the force said.
The African Union (AU) force said on its Twitter feed Thursday afternoon that "the situation is completely under control."
Paddy Ankunda, the Ugandan spokesman for AMISOM, whose contingent is in charge of the attacked base, confirmed to AFP that there is "no more fighting."
Ankunda said the assailants "sneaked into the base camp near the airport... but our troops foiled the attack." He later added on Twitter that the "attackers sneaked in incognito."
Somali police official Abdi Ahmed said strong explosions resonated at the rear entrance to the Halam base, where exchanges of gunfire were also heard.
Shebab quickly claimed responsibility.
"Our fighters are inside the headquarters of the foreign troops in Somalia," Shebab spokesman Abdulaziz Abu Musab told AFP, adding several AU soldiers had been killed.
Ankunda denied the claim, saying the intruders had suffered losses.
"The Shebab attacked us today but we managed to repulse the attackers. One of them was killed inside the base camp," Ankunda said.
An AFP photographer initially heard gunfire coming from the inside the base, and later reported firing in the area had halted.
A Western security source said between 15 and 20 attackers were involved.
By mid-afternoon, officials said the Shebab attackers had stormed the base and wounded three AU soldiers, while suffering at least one casualty in their ranks.
But their evident success in managing to penetrate the highly-guarded compound was in itself a troubling achievement.
The AU force headquarters is a fortified structure located on the grounds of the Mogadishu airport, which has also been placed under high security.
There are currently some 22,000 African Union troops as part of the AMISOM force, deployed since 2007.
They have managed to push Shebab militants out of the capital, but the Islamists still hold large swathes of territory.
Recent Shebab attacks in Somalia have targeted key government and security sites in an apparent bid to discredit claims by the authorities and African Union troops that they are winning the war.
Thursday's attack came a day after Somalia's parliament endorsed a new prime minister, appointed last week after the war-torn country's president fell out with the previous premier amid bitter infighting.
The United Nations, United States and European Union -- all key backers of Somalia's fragile government -- have all warned that power struggles in Mogadishu were a damaging distraction for the country as it tries to battle Shebab rebels.