SANAA, Yemen (AP) — Hundreds of Republican Guard forces loyal to former Yemeni president Ali Abdullah Saleh encircled the Defense Ministry in Sanaa for several hours early on Friday, protesting a move to strip the ex-president's son of part of his military command, officials said.

The officers and soldiers of the country's best trained force, which has been led by Saleh's son, Ahmed, rallied at the ministry starting late Thursday. Officials said that military officers had informed them that the force would try to storm the ministry, prompting authorities to deploy tanks and armored vehicles to the area. Government forces threatened to open fire if the protesters didn't leave. The demonstration ended several hours later.

The officials spoke on condition of anonymity because they were not authorized to speak to the press.

Saleh stepped down as part of deal brokered by Yemen's neighboring Gulf countries and backed by the United States in return for immunity from prosecution. His successor, Abed Rabbo Mansour Hadi, has pledged to restructure the armed forces in order to unify its ranks and end divided loyalties.

Despite promises to shake up the military, Hadi faced resistance from Saleh, who warned that without him and his supporters in office, the country's security would suffer. Previous orders to remove or demote Saleh loyalists were challenged.

On Monday, Hadi tried to undermine Saleh's son's command of the Republican Guard by ordering his Presidential Guard to take charge of several of the Saleh-loyalist battalions. Hadi also ordered the transfer of financial and administrative control to the president's office.

The military has been engaged in deadly battles against al-Qaida-front groups in the south of the country, where militants took control of several cities, towns and large swaths of land during a security vacuum left by last year's uprising.

The United States considers al-Qaida in The Arabian Peninsula as the most dangerous offshoot of the terror network, which has carried out several failed attacks against U.S. targets.

With U.S. help, the Yemeni military in June managed to end al-Qaida control over several urban strongholds including Zinjibar and Jaar. Al-Qaida retaliated with a wave of assassinations of top military and security officials. However, officials say that old regime loyalists are also involved in targeting Hadi's aides and those who joined last year's revolution.

Security officials said that a top military official named Omar Barsheed, who headed the Military Academy, was killed with his son when his car blew up in the city of Mukallah in the south late Thursday. The officials spoke on condition of anonymity because they were not authorized to speak to the press.

Saleh has been seen as trying to hold on to power from behind the scene. Weekly protests by youth groups demand that Hadi be held to account for killings of protesters during the uprising.