A military court in Uganda has found two officers guilty of cowardice when Islamic militants attacked an African Union camp in Somalia in May.
Major Zadock Abor and John Oluka fled after being attacked by al-Shabab in Bulo Marer, south of the capital Mogadishu. About 50 Ugandan soldiers were killed, officials say.
Uganda is part of the African Union force helping the Somali government fight al-Shabab, a branch of al-Qaeda.
The attack on Bulo Marer was one of the deadliest for the African Union force, Atmis, since it launched a new offensive against al-Shabab last year. The President of Uganda, Yoweri Museveni, criticized his army for the way it responded to the attack.
A Ugandan military court sitting in Mogadishu heard that the officers had been warned of an impending attack but failed to take steps to prevent it.
When al-Shabab militants attacked the camp, they failed to gather their soldiers and instead fled to another camp. Both officers have been dismissed from the army. Four other soldiers were also found guilty of failing to protect military equipment.
A force of 19,000 African Union troops was sent to Somalia in 2007 and helped eliminate al-Shabab from many cities. It is planned that the force will return security duties to the Somali government forces and leave the country next year. However, attacks against al-Shabab have stalled and the group still controls many rural areas in the country.