FILE - Armed al-Shabab fighters ride on pickup trucks as they prepare to travel into the city, just outside the capital Mogadishu, in Somalia on Dec. 8, 2008. AP
The soldiers were "exposed to a terrorist act" while "performing their work duties in training and qualifying the Somali Armed Forces", the ministry said in a statement on social media platform X.
Two others were wounded in the incident, the ministry said, without giving further details.
The UAE "continues to coordinate and cooperate with the Somali government in investigating the sinful terrorist act", the statement added.
A Somali military source told AFP that the gunman was a member of the Somali army who opened fire inside a training camp in the capital Mogadishu, killing and injuring an unknown number of people including soldiers from the UAE.
"The shooting was carried out by a member of the army who stayed in the camp. He was killed in the shooting," said a senior Somali army official who spoke on condition of anonymity to discuss sensitive security matters.
The attack was claimed by Al-Shabaab, a militant group aligned with Al-Qaeda that has waged a violent insurgency against Somalia's central government and its foreign backers for over 15 years.
President Hassan Sheikh Mohamud sent his condolences "to the government and the people of the United Arab Emirates over the death of the military officers in Mogadishu who came to assist in rebuilding the Somali army".
"We condemn in our strongest terms this heinous act in which these officers were killed. I have instructed an urgent investigation on the matter," he said in a post on X.
The United Arab Emirates and Somalia signed a military and security cooperation agreement in January 2023.
Short link: