President Mohamed Morsi clung to office on Tuesday after rebuffing an army ultimatum to force a resolution to Egypt's political crisis, and the ruling Muslim Brotherhood sought to mass its supporters to defend him.
But the Islamist leader looked increasingly isolated, with ministers resigning, the liberal opposition refusing to talk to him and the armed forces, backed by millions of protesters in the street, giving him until Wednesday to agree to share power.
In a defiant 2 a.m. statement, Morsi's office said the president had not been consulted before the armed forces chief-of-staff set a 48-hour deadline for a power-sharing deal and would pursue his own plan for national reconciliation.
Newspapers across the political spectrum saw the military ultimatum as a turning point. "Last 48 hours of Muslim Brotherhood rule," the opposition daily El Watan declared. "Egypt awaits the army," said the state-owned El Akhbar.
The president's office said Morsi was meeting chief-of-staff General Abdel Fateh al-Sisi and Prime Minister Hisham Kandil for the second straight day.
The confrontation has pushed the most populous Arab nation closer to the brink amid a deepening economic crisis two years after the overthrow of Hosni Mubarak, raising concern in Washington, Europe and neighbouring Israel.
Military sources said troops were preparing to deploy on the streets of Cairo and other cities if necessary to prevent clashes between rival political factions.
Protesters remained encamped overnight in Cairo's central Tahrir Square and protest leaders called for another mass rally later in the day, dubbed a "Tuesday of persistence", to try to force the president out.
Senior Muslim Brotherhood leaders branded the military ultimatum a "coup", backed by a threat that the generals will otherwise impose their own road map for the nation.
The Brotherhood's political wing, the Freedom and Justice Party, called on supporters to stage mass counter-demonstrations to "defend constitutional legitimacy and express their refusal of any coup", raising fears of violence.
One FJP leader urged "free revolutionaries" who supported Morsi to prepare for martyrdom.
HEED THE CALL
Sisi delighted Morsi's opponents on Monday by effectively ordering the president to heed the demands of the street. It took the president's office nine hours to respond with a statement indicating he would go his own way.
"The president of the republic was not consulted about the statement issued by the armed forces," it said. "The presidency confirms that it is going forward on its previously plotted path to promote comprehensive national reconciliation ... regardless of any statements that deepen divisions between citizens."
Describing civilian rule as a great gain from the revolution of 2011, Morsi said he would not let the clock be turned back. Egypt's first freely elected leader, he has been in office for just a year. But many Egyptians are impatient with his economic management and inability to win the trust of non-Islamists.
Morsi spoke to US President Barack Obama by phone on Monday, stressing that Egypt was moving forward with a peaceful democratic transition based on the law and constitution.
The White House said Obama, visiting Tanzania, encouraged him to respond to the protests and "underscored that the current crisis can only be resolved through a political process".
Six ministers who are not Brotherhood members have tendered their resignations since Sunday's huge demonstrations, including foreign minister, Mohamed Kamel Amr. The cabinet spokesman also resigned, the state news agency MENA said.
Kandil chaired a session of the rump cabinet without the key ministers of defence and the interior. Justice Minister Ahmed Suleiman denied reports that the government had resigned.
In another blow to the president, Egypt's top appeals court upheld the dismissal of the prosecutor general appointed by Morsi last year - a major bugbear to the liberal opposition.
The court removed public prosecutor Talaat Abdallah, accused of using his position to pursue journalists, artists and critics of the president while turning a blind eye to human rights abuses. It reinstated his predecessor.
Senior Brotherhood politician Mohamed El-Beltagy said the return of the Mubarak-era prosecutor was part of a creeping coup and he expected the High Committee for Elections to meet within hours to consider annulling the 2012 presidential election.
"We are therefore facing a coup against the entire revolution and not just the legitimacy of the elections and the constitution," Beltagy said on the FJP's Facebook page.
"So will the free revolutionaries allow this coup? Or will they stop it even at the price of joining a new martyrs' brigade, following the martyrs of the previous revolution?"
Compounding a sense of an administration disintegrating even as the president hangs on, Morsi's military adviser, US-trained former chief-of-staff General Sami Enan, also resigned.
El-Watan quoted senior General Adel El-Mursi as saying that if there were no agreement among political leaders to hold early presidential elections, the alternative could involve "a return to revolutionary legitimacy".
Under that scenario, the sole functioning chamber of parliament, the Islamist-dominated Shura Council, would be dissolved, the Islamist-tinged constitution enacted under Morsi would be scrapped, and a presidential council would rule by decree until fresh elections could be held under new rules, he was quoted as saying. That is largely the opposition position.
Highlighting the huge scale of anti-Morsi protests, an opposition TV station broadcast aerial footage of vast crowds thronging Cairo's central Tahrir Square, spilling over a wide adjoining area and stretching across the Nile bridges. The army used helicopters to monitor the crowds on Sunday and Monday.
World powers are looking on anxiously, including the United States, which has long funded the Egyptian army as a key component in the security of Washington's ally Israel.
General Martin Dempsey, chairman of the US Joint Chiefs of Staff, spoke to Sisi, his Egyptian counterpart, on Monday. It is unclear how far the military has informed, or coordinated with, its US sponsors but an Egyptian official said a coup could not succeed without U.S. approval.
The United Nations Human Rights office called on Morsi to listen to the demands of the people and engage in a "serious national dialogue" but also said: "Nothing should be done that would undermine democratic processes."
A senior European diplomat said that if the army were to go further and remove Morsi by force, the international community would have no alternative but to condemn the toppling of a democratically elected president.
Yasser El-Shimy, Egypt analyst at the International Crisis Group, said the army ultimatum had hardened positions on either side, making it very difficult to find a constitutional way out of the crisis - for which Morsi might have used decree powers.
"It will have to override the constitution and wage a full coup," Shimy said of the army. "Things could deteriorate very rapidly from there, either through confrontations on the street, or international sanctions.
"Morsi is calling their bluff, saying to them, 'if you are going to do this, you will have to do it over my dead body'."
The coalition that backed Sunday's protests said there was no question of negotiating now with Morsi on the generals' timetable and it was already formulating positions for discussion directly with the army once the 48 hours are up.
In his statement, Sisi insisted that he had the interests of democracy at heart - a still very flawed democracy that Egyptians have been able to practise as a result of the army pushing aside Mubarak in the face of a popular uprising in 2011.
That enhanced the already high standing of the army among Egyptians, and the sight of military helicopters streaming national flags over Cairo's Tahrir Square at sunset, after Sisi had laid down the law, sent huge crowds into a frenzy of cheers.
Among Morsi's allies are groups with more militant pasts, including al-Gamaa al-Islamiya, a sometime associate of al Qaeda, whose men fought Mubarak's security forces for years and who have warned they would not tolerate renewed military rule.
Liberal coalition leaders appointed former U.N. nuclear watchdog Mohamed ElBaradei as their negotiator with the army and are pushing for the senior judge on the constitutional court to replace Morsi as head of state for an interim period, while technocrats - and generals - would administer the country.
A military source said Sisi was keen not to repeat the experience of the 17 months between Mubarak's fall and Morsi's election, when a committee of generals formed a government that proved unpopular as the economy struggled.
The army would prefer a more hands-off approach, supervising government but not running it.
For many Egyptians, fixing the economy is key. Unrest since Mubarak fell has decimated tourism and investment and state finances are in poor shape, drained by extensive subsidy regimes and struggling to provide regular supplies of fuel.
The Cairo bourse, reopening after a holiday, shot up nearly 5 percent after the army's move.