Egypt's army commander and Islamist President Mohamed Mursi each pledged his life to defy the other as the hour approached on Wednesday that will trigger a military takeover that was prompted by mass demonstrations.
The military chiefs issued a call to battle in a statement headlined "The Final Hours". They said they were willing to shed blood against "terrorists and fools" after Mursi refused to give up his elected office. Mursi said, "The price ... is my life."
As a mass of revellers on Cairo's Tahrir Square feted the army for saving the revolutionary democracy won there two years ago, supporters of the president's Muslim Brotherhood denounced a "military coup". Some clashed with security forces at Cairo University, where 16 people died and about 200 were wounded.
Military sources told Reuters the army had drafted a plan to sideline Mursi and suspend the constitution after a 5pm local time deadline passes. Coordinated with political leaders, an interim council would rule pending new elections. The sources would not say what was planned for an uncooperative president.
Facing the expiry of a 48-hour ultimatum set by the head of the armed forces that he should agree a power-sharing deal with his rivals, Mursi broadcast a defiant, if somewhat rambling, address to the nation to defend his "legitimacy" - a word he used repeatedly in the course of 45 minutes.
Liberal opposition leaders, who have vowed not to negotiate with Mursi since the ultimatum was issued, immediately denounced his refusal to go as a declaration of "civil war". The youth movement that organised the mass protests urged the Republican Guard to arrest Mursi immediately and present him for trial.
Three hours after his midnight television appearance, the military high command responded with a post on its Facebook page. The post said they, too, were willing to lay down their lives to defend their position - one which they described as defending the Egyptian people from "terrorists, radicals and fools".
A military source said the message came from General Abdel Fattah al-Sisi, the armed forces commander appointed by Mursi last year, who issued the ultimatum to politicians on Monday.
It was posted on the official Facebook page of the Supreme Council of the Armed Forces, or SCAF. It entered history books as Egypt's ruling institution after the army pushed aside Hosni Mubarak in the Arab Spring uprising of early 2011.
"It is an honour for us to die rather than that anyone should terrorise or threaten the Egyptian people," it said. "We swear to God, we will sacrifice even our blood for Egypt and its people to defend them against any terrorist, radical or fool.
"Long live Egypt and its people."
The army has taken its cue from the millions who rallied on Sunday to call for Mursi's resignation as he completed a year in office. It appears to have only enhanced the high regard in which the military is held by most Egyptians by its action.
But as well as listening to the voice of protesters, the army also appears to have had its own concerns about the way Mursi was leading the country - notably about his alliances with more radical Islamist groups and recent association with sectarian calls to holy war in Syria.
The opposition say offers by Mursi to include them have been made in bad faith by a leader beholden to a religious movement intent on entrenching its power and Islamic ideas forever. The Brotherhood calls them bad losers who do not grasp democracy.
Sisi, a 2006 graduate of the US Army War College, has insisted he is not seeking power in the long term. Many believe the armed forces - with their extensive economic interests and generous funding - when they say they have no political ambition.
The United States has urged compromise. It has funded the army for decades, since long before the fall of Mubarak in 2011, as a key part of helping secure Washington's ally Israel. Mursi aides have said they believe a coup would need US support.
Washington has also defended the legitimacy of Mursi's election to lead the biggest Arab nation, as part of a strategy of promoting democracy in the Middle East since the Arab Spring.
President Barack Obama told Mursi by telephone that talks with opponents were needed. Mursi said on Twitter that he would not be "dictated to internally or internationally".
A senior European diplomat said world powers would have no choice but to condemn the military removal of an elected head of state, even if the generals have support on the streets.
In his television address, Mursi warned that any deviation from the democratic order approved in a series of votes last year would lead Egypt down a dangerous path.
It was unclear who fired at whom or who started the violence at Cairo University. Muslim Brotherhood supporters angrily held up rifle and shotgun cartridges after scenes of mayhem, shrouded in teargas. State television quoted a health ministry official as saying 16 people died and about 200 were hurt.
That made it by some way the bloodiest incident in several weeks of street fighting. Eight people were killed the previous day during a siege of the Brotherhood's national headquarters and the movement has said it is under attack from hired "thugs" left over from the days of Mubarak's secret police.
"The price of preserving legitimacy is my life," Mursi said in an impassioned, repetitive address to the camera. "Legitimacy is the only guarantee to preserve the country."
In a warning aimed as much at his own militant supporters as at the army, he said: "We do not declare jihad (holy war) against each other. We only wage jihad on our enemies."
Urging Egyptians not to heed the siren calls of what he called remnants of the former authoritarian government, the "deep state" and the corrupt, he said: "Don't be fooled. Don't fall into the trap. Don't let them steal your revolution."
Condemning a coup against their first freely elected leader, tens of thousands of Muslim Brotherhood supporters took to the streets, clashing with opponents in several towns.
But they were dwarfed by anti-government protesters who turned out in the hundreds of thousands across the nation.
"Mursi - Game Over - Out", proclaimed a laser display beamed over Tahrir Square, where people danced with joy, recalling the euphoria and the slogans that greeted the overthrow of Hosni Mubarak. The light show counted the hours to 5 p.m.
Despite his fighting talk, time appears to have all but run out for Mursi. Ministers have resigned and aides abandoned him.
Military sources told Reuters that, assuming the politicians fail to end a year of deadlock before the deadline, the generals have their own draft programme ready - although it could be fine-tuned in consultation with willing political parties.
Under the road map, the military would install an interim council, composed mainly of civilians from different political groups and experienced technocrats, to run the country until an amended constitution was drafted within months.
That would be followed by a new presidential election, but parliamentary polls would be delayed until strict conditions for selecting candidates were in force, the sources said.
They would not say how the military intended to deal with Mursi if he refused to go quietly. Some of his Islamist supporters have vowed to defend what they see as the legitimate, democratic order, even if it means dying as martyrs. Some have a history of armed struggle against the state.
Troops intervened to break up factional clashes in the city of Alexandria. They were also out on the streets of Suez and Port Said, at either end of the Suez Canal. The waterway is vital to world trade and to Egypt's struggling economy.
Beyond it, the Sinai peninsula has seen militant groups thrive since Mubarak fell, worrying neighbouring Israel.
The Brotherhood's political wing called for mass counter- demonstrations to "defend constitutional legitimacy and express their refusal of any coup", raising fears of violence. But the biggest pro-Mursi rally in a Cairo suburb appeared to attract around 100,000 supporters, Reuters journalists said.
Senior Brotherhood leader Mohamed El-Beltagy told the crowd: "We give our lives in sacrifice for this great legitimacy. ... We swear by almighty God to protect the will of these people and to not let it go, even if in doing this we sacrifice our souls."
But the Brotherhood long avoided direct confrontation with the security forces despite its oppression under Mubarak.
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 subsidies for food and fuel and struggling to provide regular supplies.
The Cairo bourse, reopening after a holiday, shot up nearly 5 percent after the army's move.
This week has made Sisi a household name in Egypt, but he remains a man of some mystique. Steve Gerras, a retired colonel in the US Army who was Sisi's faculty adviser at the Army War College, described him to Reuters as a serious student.
Calling him "pious, kind, thoughtful", the behavioural science professor said: "He was a serious guy. He is not a guy who would go to a stand-up comedy show. But at the same time ... his eyes were always very warm. His tone was very warm.
"He was passionate about the future of Egypt."For all the latest business news from the UAE and Gulf countries, follow us on Twitter and Linkedin, like us on Facebook and subscribe to our YouTube page, which is updated daily.
Subscribe to Arabian Business' newsletter to receive the latest breaking news and business stories in Dubai,the UAE and the GCC straight to your inbox.