An Egyptian court overturned a decision by President Mohamed Morsi to sack prosecutor general Abdel Meguid Mahmoud and ordered his reinstatement.

"The court ruled that the president's decision to sack Judge Abdel Meguid Mahmoud is void and orders the minister of justice to reinstate him," judge Sana Khalil said. The appeal was lodged by Mahmoud.

The ruling by the appeals court will once again put the presidency on a collision course with the judiciary, while any enforcement of its terms remains trapped in a legal labyrinth.

Morsi sacked Mahmud in November, in a decree that granted the president sweeping powers and placed his decisions beyond judicial review. Mahmud was replaced by current prosecutor general, Talaat Abdallah.

The decree was eventually repealed under immense street pressure, but the decisions stemming from it were protected by the constitution that was passed in December.