Uganda will send a 410-strong special force to guard UN installations in Somalia’s capital, Mogadishu, a Ugandan army spokesman has said.
The protection squad will free up thousands of UN-backed troops to pursue militant Islamists in the city, Paddy Ankunda said.
The al-Qaeda-linked al-Shabab group has stepped up attacks in Mogadishu in recent weeks.
At least 12 people were killed in a suicide bombing last Thursday.
Last June, it carried out a major assault on the main UN base in Mogadishu, leaving at least 22 people dead.
A 22,000-strong African Union (AU) force, operating under a UN mandate, is battling al-Shabab in Somalia.
Col Ankunda said the protection squad would ensure the AU force was not “bogged down” escorting UN staff – many of whom are involved in aid work.
“Amisom [the African force] will be freed to follow al-Shabab wherever they are hiding,” he added.
Al-Shabab lost control of most of Mogadishu in 2011 to AU and Somali government troops.
It has changed its strategy since then, launching guerrilla-style attacks – including suicide bombings and night-time mortar raids.
Last month, al-Shabab fighters stormed Villa Somalia, the seat of government in Mogadishu, killing at least 11 people.
The group has waged an eight-year insurgency to overthrow the weak UN-backed government and create an Islamic state in Somalia.