Feud between judiciary and president unsettles Egypt
The retraction of Prosecutor General Talaat Ibrahim's resignation on Thursday has sparked further confusion within Egypt's judiciary.
When Mr Ibrahim announced his resignation on Monday it was welcomed by the Judges' Club, an unofficial body that represents the judiciary, and opposition leaders, including Mohamed ElBaradei of the National Salvation Front.
His decision followed protests outside his office by judges who were angry that he had been appointed by President Mohammed Morsi, and not by the Supreme Judicial Council (SJC), which handles administrative affairs and judicial appointments.
The dismissal of Mr Ibrahim's predecessor, Abdel Maguid Mahmoud, was announced in a presidential decree on 22 November which triggered widespread outrage.
Mr Morsi's constitutional declaration stated that his decisions were "final and unchallengeable by any individual or body" until a new constitution had been approved in a referendum and fresh parliamentary elections held.
It also said the constitutional drafting assembly could not be dissolved by the judiciary, pre-empting a ruling by the Supreme Constitutional Court (SCC). Liberals, Christians and secularists had complained the assembly was dominated by Islamists.
Judges condemned the decree, describing it as a "violation of the judiciary's independence", and those working at the Court of Cassation and Court of Appeal suspended all work until it was rescinded.
Many judges also decided to boycott the constitutional referendum called by President Morsi after the constituent assembly approved a rushed draft on 30 November, and began demanding Mr Ibrahim's resignation.
The judiciary's protests, along with widespread demonstrations by opposition supporters and violent clashes with Islamist supporters of the president, put increasing pressure on Mr Morsi to withdraw the decree.
On 8 December, the president bowed to the pressure and rescinded most of his 22 November decree.
With their main goal achieved, judges were divided over whether to supervise the referendum. Many agreed with the opposition that the vote should be postponed while the draft constitution was amended or re-written.
The Cairo Judges' Club repeated its call for a boycott. Its chairman, Ahmed al-Zind said that more than 90% of judges' clubs across the country would join it.
Mr Zind also said the judiciary was not taking the side of any party in the constitutional crisis, insisting that judges did not intervene in politics.
Other parts of the judiciary - including the Supreme Judicial Council, State Council, the Administrative Judiciary, the Independent Judiciary Movement and the State Litigation Authority - agreed to supervise the referendum.
Hamdi Yassin, the head of the State Council's judges, placed conditions on their participation, including the end of the blockade around the SCC's offices in Cairo by the president's supporters.
The split in the judiciary meant there were enough judges to supervise the first stage of the referendum on 15 December, according to Zaghloul al-Balshi, secretary-general of the Higher Electoral Commission, although several civil society groups reported that judges had not been present at every polling station.
In this context, Saad al-Katatani, head of the Muslim Brotherhood's Freedom and Justice Party, praised the willingness of judges to do their job and said: "I hope that this action will be the beginning of the solution of the current crisis."
However, ahead of the referendum's second round on 22 December, State Council's judges said they would no longer supervise voting because their conditions had not been met - particularly the end of the blockade of the SCC. It was reported that the SCC's president had been prevented from entering its offices.
Mr Morsi has told his supporters that he issued his now-rescinded decree to protect the transition and prevent the SCC dissolving the constituent assembly.
The court has responded by asking him to provide evidence that its judges had decided to do so.
Many commentators and analysts say the dispute between the judiciary and the president is very dangerous and represents a critical moment in the transition to democracy in post-Mubarak Egypt.