Uganda has decided to pull its troops out of Somalia by December 2017
It provides the biggest contingent of soldiers to the African Union force fighting militant Islamist group Al-Shabab.
Uganda’s Chief of Defence Forces, General Katumba Wamala, told the BBC the decision was taken because of frustration with the Somali army and international partners.
He said it was time for Somalia’s army to take over its own security, but that was not happening.
The US, UK and Turkey were among countries training Somali soldiers and police officers.
But Uganda’s government says they are not coordinating their activities and this is causing problems.
Some have questioned the effectiveness of the AU mission in Somalia because it has struggled to secure areas outside the big towns. It has also been plagued by allegations of corruption.
General Wamala said Uganda could pull out before December 2017 if another country was found to replace it.