Mohammed Morsi, Egypt's embattled President, stared down his last stand as the country faced a second revolution.
Before today's military ultimatum, Morsi made a last-ditch effort to stay in power by meeting the head of the army and promising to resist attempts to remove him from office.
This spurred senior military commanders to hold emergency talks, which were still going on just before midnight last night (NZ time).
At the start of the meeting, they swore to defend Egypt with their lives. "We swear to God that we will sacrifice our blood for Egypt and its people against all terrorists, extremists and the ignorant," they declared in an oath led by army chief Abdel Fattah al-Sisi.
Clashes between Morsi's supporters and opponents left at least 23 dead, most of them in a single incident of fighting outside Cairo University.
Muslim Brotherhood leaders, who claim their election victories since the overthrow of the dictator Hosni Mubarak are the country's sole source of political legitimacy, said they would not step down in the face of the army ultimatum made on Tuesday.
"Seeking martyrdom to prevent the ongoing coup is what we can offer as a sign of gratitude to previous martyrs who died in the revolution," said Mohammed el-Beltagy, the general secretary of the Brotherhood's political front, the Freedom and Justice Party.
Essam el-Erian, a member of the Brotherhood's ruling Guidance Council, warned there could be a bloodbath.
"If they want to continue with this plan, there will be far more victims, because this will be the victims confronting the people."
Morsi demanded that the powerful armed forces withdraw their ultimatum, saying he rejected all "dictates" from home or abroad.
In an emotional speech aired live to the nation, the Islamist leader who a year ago was inaugurated as Egypt's first freely elected President, accused Mubarak loyalists of exploiting the wave of protests to topple his regime and thwart democracy.
"There is no substitute for legitimacy," said Morsi, at times angrily raising his voice, thrusting his fist in the air and pounding the podium. He warned that electoral and constitutional legitimacy "is the only guarantee against violence".
Earlier he said he would "not allow Egypt to return to the past".
But the opposition scented victory. Liberal, leftist and secular parties, figures linked with the Mubarak regime and street protest movements including Tamarod, or "Rebellion", which organised the biggest marches in Egypt's history, readied their platforms for the new "inclusive" Government.
The military's political road map unveiled yesterday met all their main demands: fresh elections, a new constitution, an interim ruling council and an end to Islamist domination.
The leading opposition groups appointed Mohamed Elbaradei, the former head of the United Nations atomic energy agency who has been a spokesman for the revolutionary cause but repeatedly refused to run for office, as its chief spokesman for any transition.
Politicians rejected accusations that they were fronts for the Mubarak regime, as alleged by Brotherhood leaders. They said they were fighting the gradual but forceful imposition of the Brotherhood's agenda, particularly since Morsi pushed through a heavily Islamist constitution in November.
Mohammed Abou El-Ghar, the head of the Egyptian Social Democratic Party, said: "Our goal is not to govern Egypt, not to control Egypt, but to open the door for a new presidential election, which is a normal thing after a new constitution, and to prevent fascist power from taking over the country." He said he had no worries about another dictatorship. "I'm sure that the army does not want to rule Egypt."
Morsi's power base was reduced dramatically yesterday, as six ministers resigned.
It was not clear what compromise he could offer to al-Sisi, who is also Defence Minister. Opponents say they will accept nothing but his removal from office.
The President's advisers had not said how they intend to resist the ultimatum. Islamist movements have promised they will stick to non-violence, but the Brotherhood has been parading volunteers in quasi-military style, and also played up its relationship with the Gamaa Islamiya, a militant group responsible for some of Egypt's worst terrorist outrages, which has since renounced violence.
One of the motors that drove current anger with the Brotherhood was a decision by Morsi last month to make a Gamaa Islamiya official a provincial governor - not just of any province, but of Luxor itself, the scene of its worst crime and where any attempt to resurrect the crumbling tourism industry would begin.
The nation looked on with baffled outrage; Brotherhood officials blithely compared the decision to the Northern Ireland peace process and post-apartheid reconciliation in South Africa, seemingly unaware how extraordinary the decision looked to the outside world.
There is a deeper message here, underwriting the Brotherhood's welcoming of former terrorists on its stages: when it comes to Islamism, the Brotherhood is your best hope, it is saying. There are other groups waiting in the wings. As its spokesmen repeatedly say, when accused of being sectarian, or monopolising power: "At the moment, we are trying to be inclusive."
In an interview with the Daily Telegraph yesterday, Essam el-Erian, a member of the Brotherhood's Guidance Council or Politburo, gave a rather unusual warning to Egypt's Christian minority: "My advice to the Coptic people is, do not be part of this operation. Don't be used as a card in a political struggle, because you will be the losers. Be neutral and don't depend on the fact that the Brotherhood are not oppressing you. We will not oppress you but we will not satisfy you."