CAIRO (Reuters) - Egyptian President Mohamed Mursi vowed to stay in power and defend constitutional legitimacy on Wednesday as generals worked on plans to push the Islamist aside within the day and suspend the constitution.
In a defiant midnight television address responding to military demands that he share power with his opponents or see the army impose its own solution, Mursi warned that any deviation from the democratic order approved in a series of votes last year would lead Egypt down a dangerous path.
He was speaking as vast crowds of protesters rallied in central Cairo and across the nation to demand the Muslim Brotherhood politician's resignation in a third night of mass demonstrations. His supporters also turned out and some were involved in clashes with security forces at Cairo University.
"The price of preserving legitimacy is my life," Mursi said in an impassioned, repetitive, 45-minute ramble. "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 regime, "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."
An opposition spokesman called Mursi's defiance "an open call for civil war". Peaceful protests would go on, he said.
On Monday, army commander General Abdel Fattah al-Sisi gave Mursi 48 hours to reach an accommodation with his opponents. Otherwise, he said, the military would step in and implement its own roadmap for the country's future.
A military spokesman said the armed forces would not comment on the president's statement until Wednesday afternoon. The deadline is set to expire at 5 p.m. (1500 GMT).
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 their hundreds of thousands across the nation.
Security sources said dozens of people were wounded in the clashes at Cairo University involving Mursi supporters. Witnesses heard gunfire and teargas was used by the authorities.
Troops were on alert amid warnings of a potential civil war. Seven people died in a demonstration crush and sporadic fighting in Cairo and hundreds more were wounded in the provinces.
"Mursi - Game Over - Out", proclaimed a laser display beamed over the capital's jam-packed Tahrir Square, where Egyptians danced with joy, recalling the euphoria and the slogans that greeted the overthrow of Hosni Mubarak two years ago. The light show counted the hours to the army deadline.
Despite his fighting talk, time appears to have all but run out for Mursi, as liberal leaders refuse to talk to him, while ministers have resigned and aides abandoned his sinking ship.
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 to implement - though it could be fine-tuned in consultation with willing political parties.
Under the roadmap, 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. And some have a history of armed struggle against the state.
The confrontation has pushed the most populous Arab nation closer to the brink of chaos amid a deepening economic crisis two years after the overthrow of Mubarak, raising concern in Washington, Europe and neighbouring Israel.
Troops intervened to break up clashes in the Mediterranean 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.
Egypt's Coptic Pope, spiritual leader of the country's 10 percent Christian minority, expressed open support for the anti-Mursi "Tamarud - Rebel!" movement in a tweet, voicing support for the national trio of people, army and youth.
The leading Muslim religious authority, Al-Azhar, called for the will of the people to prevail peacefully.
Mursi met Sisi for a second day, his office said, along with Prime Minister Hisham Kandil but there was no sign of any meeting of minds.
Though Mursi has held out repeated offers of dialogue, liberal opponents accuse him and the Brotherhood of bad faith and have ruled out starting talks with him before the deadline.
After that, former U.N. nuclear agency chief Mohamed ElBaradei will deal directly with the military on behalf of the main coalition of liberal parties. Also planning to take part are leaders of the Tamarud youth movement, which initiated mass rallies on Sunday that the army says prompted it to act.
Among figures being considered as an interim head of state was the new president of the constitutional court, Adli Mansour.
The new transition arrangements would be entirely different from the military rule that followed Mubarak's fall and more politically inclusive, the sources said.
Then, the ruling armed forces' council was criticised by liberal and left-wing politicians for failing to enact economic and political reforms - and for siding with the Brotherhood.
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 the a Cairo suburb appeared to attract around 100,000 supporters, Reuters journalists said.
The Brotherhood long avoided direct confrontation with the security forces despite suffering oppression under Mubarak.
The United States, which has previously defended Mursi's legitimacy as a democratically elected leader, stepped up pressure on him to heed the mass protests but stopped short of saying he should step down.
President Barack Obama told Mursi in a phone call late on Monday that the political crisis could only be solved by talks with his opponents, the White House said. Secretary of State John Kerry hammered home the message in a call to his outgoing Egyptian colleague on Tuesday.
That prompted Mursi to say in a tweet that he would not be "dictated to internally or internationally".
At least six ministers who are not Brotherhood members have tendered their resignations since Sunday, including Foreign Minister Mohamed Kamel Amr. The president's two spokesmen and the cabinet spokesman also quit on Tuesday and nearly 150 Egyptian diplomats signed a petition urging Mursi to go.
Senior Brotherhood politician Mohamed El-Beltagy denounced what he called a creeping coup. He said he expected the High Committee for Elections to meet within hours to consider annulling the 2012 presidential election.
The United States has long funded the Egyptian army as a key component in the security of Washington's ally Israel.
General Martin Dempsey, chairman of the U.S. Joint Chiefs of Staff, spoke to his Egyptian counterpart on Monday. It is unclear how far the military has informed, or coordinated with, its U.S. sponsors but an Egyptian official said a coup could not succeed without U.S. approval.
A senior European diplomat said that if the army were to remove the elected president, the international community would have no alternative but to condemn it.
Yasser El-Shimy, Egypt analyst at the International Crisis Group, said the army ultimatum had hardened positions, making it very difficult to find a constitutional way out of the crisis.
"Things could deteriorate very rapidly from there, either through confrontations on the street, or international sanctions," he said.
"Mursi is calling their bluff, saying to them, 'if you are going to do this, you will have to do it over my dead body'."
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.
Reporting by Asma Alsharif, Alexander Dziadosz, Shaimaa Fayed, Maggie Fick, Alastair Macdonald, Shadia Nasralla, Tom Perry, Yasmine Saleh, Paul Taylor and Patrick Werr in Cairo, Abdelrahman Youssef in Alexandria and Yursi Mohamed in Ismailia; Writing by Alastair Macdonald and Paul Taylor; Editing by Alastair Macdonald