Egypt's armed forces have handed Islamist president Mohammed Morsi a 48-hour deadline to share power.
A dramatic military statement broadcast on state television declared the nation was in danger, after hundreds of thousands of Egyptians took to the streets on Sunday to demand Mr Morsi quit.
Armed forces declares nation in danger, urges compromise
If no political deal in 48 hours, army will present plan
Muslim Brotherhood HQ ransacked, police absent
Five cabinet ministers quit in sympathy with protests
Biggest protests since Hosni Mubarak toppled
At least eight people were killed, hundreds more were wounded and the headquarters of the ruling Muslim Brotherhood was ransacked.
The military has given feuding politicians 48 hours to compromise or have the army impose its own road map for the country.
"If the demands of the people are not realised within the defined period, it will be incumbent upon (the armed forces)... to announce a road map for the future," chief-of-staff General Abdel Fattah al-Sisi said.
General Sisi said the people had expressed their will with unprecedented clarity in the mass demonstrations, and wasting more time would only increase the danger of division and strife.
Mr Morsi's backers were furious at the statement.
"The age of military coups is over," Yasser Hamza, from the Brotherhood parliamentary wing, said.
But it provoked delight among liberal leaders and crowds in Cairo's Tahrir Square, who cheered when a flight of military helicopters swooped overhead trailing national flags.
Silhouetted against the sunset, it was a powerful illustration of the military's desire to be seen in tune with the people.
The army said it would oversee the implementation of the roadmap it sought "with the participation of all factions and national parties, including young people", but it would not get directly involved in politics or government.
Mr Morsi's office later said the president met General Sisi and prime minister Hisham Kandil, releasing a picture of them seated together smiling, but did not respond to the military statement.
The main opposition National Salvation Front, which has demanded a national unity government for months, applauded the military's move.
The army is held in high regard, especially after it helped topple former Egyptian president Hosni Mubarak two years ago.
On Cairo's Tahrir Square, thousands celebrated the army's move.
"We want a new armed forces council to govern until new elections," accountant Mohamed Ibrahim said.
"The army alone supports the legitimate revolutionary will of the people."
Amr Moussa, a liberal politician and former foreign minister who stood in last year's presidential election, said: "The invitation to meet the demands of the people within the next few hours is a historic opportunity which should not be lost."
Pressure mounts for 'consensus' government
It was the second time in just over a week that the armed forces had issued a formal warning to the politicians, piling pressure on Mr Morsi to concede power-sharing with the liberal, secular and left-wing opposition.
The armed forces have played an important role in Egyptian politics since army officers staged the overthrow of the monarchy in 1952.
Since the fall of Mubarak when the Arab Spring revolutions took hold, the Arab world's most populous nation has remained in turmoil, arousing concern among allies in the West and in neighbouring Israel, with which Egypt has had a peace treaty since 1979.
VIDEO: Professor Bob Bowker discusses Egypt unrest (ABC News)
Sunday's mass rallies were bigger than anything seen since the Arab Spring uprising.
Protest organisers, who declared Mr Morsi ousted by people power on Sunday, said they hoped people would stay in the streets until Mr Morsi left.
The United States and the European Union have urged Mr Morsi to share power with the opposition, saying only a national consensus can help Egypt overcome a severe economic crisis and build democratic institutions.
US president Barack Obama renewed a call for Mr Morsi and his adversaries to cooperate, just as General Sisi's statement was made.
The Pentagon, which funds the Egyptian army heavily, said it could not speculate on what was about to happen in Egypt.