Cairo: Egypt’s top appeal court on Tuesday overruled a controversial decision by Islamist President Mohammad Mursi to sack the country’s Mubarak-era chief prosecutor and ordered his reinstatement.

The Court of Cassation said Mursi’s sacking of Abdul Majid Mahmoud as public prosecutor last year and replacing him with Talaat Abdullah was illegal. The ruling, which is final, comes at a time when Mursi is under intense pressure from the opposition and the army to step down, a year after taking office.

In November, Mursi sacked Mahmoud in a move that angered the judiciary and the opposition who condemned it as a violation of the judiciary’s independence.

Since taking office in June last year, Mursi, who hails from the Muslim Brotherhood, has been wrangling with the judiciary after a series of court rulings including the dissolution of an Islamist-led parliament.

Mursi’s Islamist allies have accused the judges of issuing “politicised” verdicts.

The grassroots Tamarod (rebellion) movement, which is leading a protest campaign for Mursi’s removal, has proposed that the chief judge of the Supreme Constitutional Court rules Egypt for a transitional period until a new president is elected.

Earlier in the day, an Egyptian Islamist coalition supporting President Mursi, said it opposed what it called “use of the army to stage a coup against legitimacy” after the military gave political leaders a two-day deadline to end a deep political crisis with the opposition.

The National Coalition for Legitimacy Support, an umbrella grouping of Islamist parties, said in a statement addressed to the army on Monday night “not to be biased to any faction” — a reference to Mursi’s opponents.

Defence Minister Abdul Fatah Al Sissi on Monday issued the toughest warning yet to the country’s squabbling politicians, mainly Mursi.

“If the people’s demands are not met within the mentioned duration, the Armed Forces, based on their national and historic responsibility and out of respect to the demands of Egypt’s great people, will find themselves obliged to announce a map for the future and measures, which they [army] will supervise [],” Al Sissi added in a televised statement.

The Muslim Brotherhood did not officially comment on Al Sissi’s statement. However, Mohammad Al Beltaji told supporters to take to the streets to show opposition to the army’s perceived pressure on Mursi.

“The army is required to protect the peaceful demonstrations, which want to support legitimacy and reject [a] coup against it,” Al Beltaji told a pro-Mursi rally in the Cairo area of Rabaa Al Adawia. He denied media reports that Brotherhood leaders had fled the country following Al Sissi’s warning.

A military spokesman said the army did not plan a coup against Mursi.

“The faith and culture of the Armed Forces do not allow them to pursue the policy of military coups,” said army spokesman Ahmad Ali on Facebook.

Several opposition leaders have called on the army to remove Mursi. Hundreds of thousands of opposition protesters stayed past midnight across the nation, celebrating the army’s statement. Protesters outside the presidential palace in eastern Cairo set off fireworks while chanting: “The army and the people are one hand” — a famous slogan dating back to a 2011 uprising that toppled president Husni Mubarak.

Opponents and backers of Mursi are set to launch rival rallies across Egypt on Tuesday in a show of strength, raising fears about street violence. Sixteen people have been killed and more than 700 injured in clashes between the two sides since Sunday, according to health authorities.

Thousands of pro-Mursi demonstrators gathered on Monday night near Cairo University chanting slogans in his support. The Tamarod campaign has, meanwhile, called for mass protests on Tuesday to press Mursi to resign or face a general strike across the country.