CAIRO (Reuters) - Egypt's public prosecutor said on Saturday he will keep his job, in a blow to President Mohamed Mursi who just two days ago sought to replace the Hosni Mubarak-era official by appointing him as ambassador to the Vatican.
Mursi's effort to remove Abdel Maguid Mahmoud from his post was seen as a response to the acquittal of senior Mubarak-era officials who had been standing trial on charges of organizing violence during the uprising against the deposed leader.
But the move triggered an outcry from judges who said Mursi had exceeded his powers. Critics attacked the new president for a step they described as an attack on the independence of the judiciary.
Since he came to office as Egypt's first freely elected president, Mursi has removed other Mubarak-era officials including Field Marshal Hussein Tantawi, Mubarak's former defense minister, and other top generals.
In an elaborate resolution of the crisis, the Supreme Judicial Council presented Mursi with a petition on Saturday demanding Mahmoud stay in his job. The presidency in turn said Mursi would halt moves to make him an ambassador.
Al-Ahram, the state-run newspaper, declared it a "victory for the judiciary over the presidency".
Vice President Mahmoud Mekky, who also serves as Mursi's justice minister, told journalists that Mursi had appointed Mahmoud as an ambassador with his consent, denying the president had ever sacked him. He said the move was legally sound.
But perceptions that Mursi had tried to fire Mahmoud spread widely, prompting commentators to ask where Mursi gets his legal advice. "Since when has the president of the republic had the capacity to sack the prosecutor general?" Suleiman Gouda, writing in the widely read al-Masry al-Youm daily.
Mekky said the step had been designed to spare Mahmoud the anger of families of the victims of the violence perpetrated against demonstrators during the mass uprising against Mubarak. Mahmoud has said he had faced intimidation to quit.
Arriving for work on Saturday, Mahmoud defiantly told journalists he would only leave his post "via assassination".
On Wednesday, high profile members of the Mubarak administration were cleared of any involvement in orchestrating "The Battle of the Camels" - when men on horses and camels rode into Tahrir Square in an attempt to dislodge protesters at the height of the uprising against Mubarak.
The acquittals led to calls for protests on Friday by the Muslim Brotherhood, the group which propelled Mursi to power. But instead more than 140 people were injured when the Islamists clashed with Mursi opponents who had already called for protests against the president. The streets were calm on Saturday.
(Writing by Tom Perry; Editing by Jon Hemming)