MOGADISHU (Reuters) - Rival forces in the Somali army shot at each other in the capital Mogadishu on Monday, with one group trying to storm a former United Arab Emirates-run training center, soldiers and residents said.

Slideshow ( 3 images )

The clash was an indication of the difficulty in rebuilding unified security forces for a state where centralized authority collapsed in 1991 and an internationally backed government, elected last year, faces huge challenges.

It was also another sign of the fallout from a crisis in the Gulf region that has spilled into the Horn of Africa.

The UAE has trained hundreds of troops since 2014 as part of an effort boosted by an African Union military mission to defeat an Islamist insurgency and secure the country for the government backed by Western countries, Turkey and the United Nations.

The Gulf nation ended its program in Somalia this month after Somali security forces seized millions of dollars and temporarily held a UAE plane.

“Some Somali military forces attacked us at the base, they wanted to loot it but we repulsed them,” Ahmed Nur a soldier who was trained under the discontinued program, told Reuters.

After 90 minutes of sporadic gunfire, the training facility was secured by presidential palace guards, a Reuters journalist at the scene said.

General Abdiweli Jama Gorod, the commander of Somali National Army said they had arrested some soldiers who were behind the attempt take away equipment from the facility.

“The Somali national forces now have in hand the few soldiers and officers who were behind today’s incident and we assure we shall bring them before justice,” he said on state-run Somalia News Agency.

Some of the UAE-trained Somali soldiers had fled, said Abdirahman Abdullahi, a second soldier who was also trained under the program: “Most of my colleagues jumped over the wall and ran away with their guns. Others left the guns and ran away and so I had to (flee) also.”

Residents in the area said they saw UAE trained forces discarding their military uniforms and fleeing the facility in three-wheeled rickshaws with their guns in their laps.

Somalia’s relations with the UAE have been strained by a dispute between Qatar and Saudi Arabia. The UAE is part of a group of Arab states including Saudi Arabia that has ostracized Qatar. Countries on both sides of the dispute have influence in Somalia, and Mogadishu has refrained from taking sides.