Egypt leader Mursi backs down in row with prosecutor
President Mohammed Mursi of Egypt has agreed to allow the Mubarak-era chief prosecutor to keep his job after an embarrassing public row.
Spokesmen for Mr Mursi and the prosecutor, Abdel Maguid Mahmoud, confirmed an agreement had been reached at talks in the capital, Cairo.
Mr Mahmoud earlier returned to work, escorted by judges and lawyers.
He has been criticised for acquitting officials accused of attacking protesters under Hosni Mubarak.
The acquittals sparked violent protests in Tahrir Square in Cairo on Friday when supporters and opponents of President Mursi clashed.
More than 110 people were injured in the worst violence seen since he took office at the end of June.
Saturday's outcome is a big defeat for Mr Mursi, who until now has been steadily consolidating power, says the BBC's Jon Leyne in Cairo.
Under the old government, there was often criticism that judges and prosecutors were susceptible to government pressure. Our correspondent says they are now fighting hard to assert their independence from the new government.'Unless I am assassinated'
Mr Mahmoud's return to his office on Saturday was a symbolic display of independence, after President Morsi tried to remove him by appointing him ambassador to the Vatican, our correspondent says.
The decision to re-instate the prosecutor general is a big blow for President Mursi.
It shows the limit of his power, after months in which he had steadily been consolidating his grip.
It's also important because control, or influence, over the judiciary could be crucial in Egypt's future.
Already one court has dissolved parliament.
Another is considering whether to dissolve the constitutional assembly, which has nearly finished preparing a new draft constitution.
A number of judges reportedly threatened to resign as well.
The chief prosecutor vowed to serve out his term, telling reporters: "I occupy this office and I will defend myself, and I will defend my position, and I will defend the independence of the prosecutor general, and the independence of the judges, and I will not leave this office unless I am assassinated."
The prosecutor went on to a meeting with one of the vice-presidents, in an attempt to defuse the situation.
Mr Mahmoud's deputy, Adel Said, said later that the chief prosecutor and President Mursi had met and agreed that he would stay in office.
There had been a "misunderstanding" over Mr Mahmoud's nomination to the Vatican, Mr Said was quoted as saying by state TV.
Vice-President Mahmoud Mekki confirmed for reporters that Mr Mursi had agreed to keep Mr Mahmoud in his post.