Museveni’s statement on Saturday comes a week after al-Shabab fighters stormed the base in Bulamarer, 130 kilometres (80 miles) southwest of the Somali capital, Mogadishu.
The armed group claimed it carried out suicide bomb attacks on May 26 and killed 137 soldiers.
Museveni said on Saturday that the Uganda People’s Defence Forces (UPDF) had since recaptured the base from the al-Qaeda-linked armed group.
“Our soldiers demonstrated remarkable resilience and reorganised themselves, resulting in the recapture of the base by Tuesday,” the president said.
Museveni said last week that there had been Ugandan casualties but had not given further details about the attack on the troops, who are serving in the African Union Transition Mission in Somalia (ATMIS).
Al-Shabab has been fighting since 2006 to replace Somalia’s Western-backed government with its own rule based on a strict interpretation of Islamic law.
Last August, an intensive government offensive began after the election victory of President Hassan Sheikh Mohamud and has made significant gains in eroding the group’s control of vast swathes of Somali land.
But al-Shabab is still capable of launching significant attacks on government, commercial and military targets.
It also intermittently launches attacks in neighbouring Kenya as part of reprisals for Nairobi sending troops to support Mogadishu’s rebel pushback.
ATMIS, which has 22,000 troops, has been assisting Somalia’s federal government in its war against al-Shabab since 2022 when it replaced the AU Mission in Somalia (AMISOM).