The incident in Mogadishu happened after a Somali army recruit discharged his gun targeting the soldiers inside the military facility.
The African Union Transition Mission in Somalia (Atmis) on Monday condemned Saturday's incident in which five senior military officers were killed and vowed to work with the country to fight terrorism.
The African Union Special Representative for Somalia Mohamed El-Amine Souef confirmed that four military officers from the United Arab Emirates (UAE) and one from Bahrain were shot dead at the General Gordon Military Base, operated by the UAE.
"On behalf of Atmis, I condemn in the strongest terms the attack on the military trainers and Somali soldiers at the Base, who were working towards advancing Somalia's security efforts," Souef said in a statement issued in Mogadishu, the capital of Somalia.
The incident in Mogadishu happened after a Somali army recruit discharged his gun targeting the soldiers inside the military facility.
The UAE soldiers were on a training mission of the Somali National Army as part of the bilateral agreement between the UAE and Somalia.
"Atmis remains deeply committed to working with the people, the Federal Government of Somalia, and international partners in the fight against terrorism," the AU mission said.
Souef extended his condolences to the government of the UAE, and to the families, relatives, and friends who lost their loved ones, and wished a speedy recovery to the injured.
Al Shabaab, which has been fighting the government for more than two decades, claimed responsibility for the attack, saying its fighters killed many people involved in the Emirati military training mission in Somalia.