A deal has been struck that will see Egypt's prosecutor-general remain in office after President Mohamed Morsi earlier attempted to have him replaced.

The agreement, sealed on Saturday after a meeting between Morsi and Prosecutor-General Abdel-Meguid Mahmoud, stipulates that Mahmoud will remain in office until retirment age.

Egyptian state television reported that the two met and sealed the agreement under which "the state prosecutor will stay on in his post," said deputy state prosecutor Adel Said, citing a "misunderstanding over his nomination as ambassador to the Vatican".

The Egyptian president had ordered Mahmoud to step down in an apparent bid to appease public anger over the acquittals of ex-regime officials accused of orchestrating violence against protesters last year.

To overcome the constraints on removing him, Morsi's decision asked Mahmoud to become ambassador to the Vatican. But Mahmoud refused to be re-appointed.

Mahmoud said he would not leave his post despite official pressure for him to step down. Before heading to the president's office to discuss ways to defuse the standoff, Mahmoud said to a meeting of judges and attorneys that he was subjected to pressure and threats from Morsi's advisors.

"I refuse to work anywhere else except as prosecutor-general, even if I was offered a ministerial position," Mahmoud said in comments carried by the MENA press agency.

Al Jazeera's Rawya Rageh, reporting from Cairo, said "Judges, lawyers and the head of the bar association are already celebrating this fact that the prosecutor-general will remain in office... saying that any measure against Abdel-Meguid Mahmoud would have been tantamount to a crime against the nation and not against the prosecutor-general alone."

Regarding Morsi's initial decision to remove Mahmoud, Rageh said "the president was responding to public pressure".

"There has been renewed anger triggered by the acquittal last week of more than 20 of [Hosni] Mubarak's inner circle ... there has been specific anger directed at Abdel-Meguid Mahmoud, at his office, with the perception among revolutionaries in the protest movement that the Egyptian revolution had stopped at the doors of the prosecutor-general's office," she said.

Public support

Morsi appeared to have broad public support for removing Mahmoud, who was appointed under ousted president Mubarak.

But the prosecutor and a powerful judges' club said the move infringed on the judiciary's independence, as Egyptian law protects the judicial officials such as the prosecutor-general from be fired by the president.

Many say a whole overhaul of the judiciary, not just removal of the prosecutor-general, is needed to effect change in justice.

The standoff with the prosecutor-general continued as Morsi faced a new challenge in the form of violent protests between his supporters and critics.

The judicial standoff formed the backdrop to rival rallies on Friday in Tahrir square that escalated into street fighting between his supporters and his critics, the first such confrontation since Morsi came to office in late June.

Pro-Morsi protesters held a rally in Tahrir square to urge the removal of Mahmoud. But they clashed with anti-Morsi demonstrations planned before to denounce the lack of progress on economic issues and a hotly contested constitution still in a drafting process.

At least 100 people were injured in the unrest on Friday.

Source: Al Jazeera And Agencies