Egypt's new public prosecutor has offered to resign from his post after protests about his appointment.
Talaat Ibrahim was appointed by President Mohammed Morsi last month after his predecessor was sacked.
The move prompted anger among members of the judiciary who saw the sacking of Abdel Maguid Mahmoud as an attack on their independence.
Judges and officials had demonstrated outside Mr Ibrahim's office on Monday, called on him to stand down.
Security forces prevented a group of the protesters from going into the office to demand a meeting, state-owned al-Ahram newspaper said.
More than 1,300 judicial workers who had gathered outside his office greeted news of the resignation letter with cries of: "God is Great! Long live justice!", Reuters news agency reports. Controversial constitution
Mr Ibrahim had been given the job of re-examining all investigations into the deaths of protesters when ex-President Hosni Mubarak was in power.
In his letter of resignation to the Supreme Judicial Council, published by the Mena state news agency, he said he wished to "return to his work in the judicial system".
His resignation is expected to be presented before the Council next Sunday, a day after a final round of voting in a referendum on Egypt's controversial draft constitution.
The first round of the referendum was held over the weekend, with many judges boycotting supervision of the vote.
Opponents say the constitution has been rushed through and fails to protect the rights of minorities, particularly women.
There are growing tensions between President Morsi and his Muslim Brotherhood supporters on one side, and his mainly secular political opponents and the judiciary on the other.
Mr Morsi adopted sweeping new powers in a decree on 22 November, stripping the judiciary of any power to challenge his decisions.
One of his first decisions was to sack Mr Mahmoud - first appointed as chief prosecutor by Mr Mubarak.
The decree spurred nationwide protests and clashes between Mr Morsi's supporters and opponents.
Under pressure, the president revoked the decree but kept the new prosecutor-general in place.