Local sources said a massive blast was heard in the Bulomarer district, around 150 kilometres (93 miles) south of Mogadishu, and fighting broke out after dozens of heavily armed Shabaab militants stormed the base.
“The heavy blast struck the base before fighting broke out. We are hearing the militants used a minibus loaded with explosives to make their way in before the heavily armed confrontation started at the camp,” said local security official Ibrahim Abdilahi.
“There was heavy fighting and we could see smoke rising above the military base,” said witness Mohamed Sharif.
Ugandan army spokesman Brigadier Richard Karemire said his army had “lost four gallant soldiers and six sustained minor injuries”.
He said that 30 Shabaab militants had been killed, while the Islamists claimed in a statement to have killed 59 Ugandan soldiers.
The Al-Qaeda linked Shabaab was pushed out of the Somali capital in 2011 — and subsequently other towns and cities — by soldiers from the African Union Mission in Somalia (AMISOM).
But the Islamists still hold sway in large parts of the countryside and launch regular gun and bomb attacks on government, military and civilian targets in Mogadishu and ambushes on military convoys and outposts.
East African leaders contributing to the 22,000-strong AMISOM force last month called for the United Nations to reconsider plans to withdraw troops by December 2020, saying the timeline was unrealistic and could lead to a reversal of gains.