Cairo - With Egypt's first democratically elected president overthrown by the military, the country on Thursday faced an unprecedented political limbo.
Milllions celebrated all night while Mohammed Morsi - ousted after only a year in office by the same kind of Arab Spring uprising that brought the Islamist leader to power - and his Muslim Brotherhood blasted the action as a "full coup" by the generals.
The military on Wednesday also suspended the Islamist-drafted constitution, called for new elections and announced it would install a temporary civilian government. The country's chief justice was to be sworn in as interim president later Thursday.
Millions of anti-Morsi protesters around the country erupted in celebrations after the televised announcement by the army chief on Wednesday evening. Fireworks burst over crowds in Cairo's Tahrir Square, where men and women danced, shouting, "God is great" and "Long live Egypt."
Fearing a violent reaction by Morsi's Islamist supporters, troops and armoured vehicles deployed in the streets of Cairo and elsewhere, surrounding Islamist rallies. Clashes erupted in several provincial cities when Islamists opened fire on police, with at least nine people killed, security officials said.
Gehad el-Haddad, a spokesperson for the Muslim Brotherhood party, said Morsi was under house arrest at a Presidential Guard facility where he had been residing, and 12 presidential aides also were under house arrest.
The army took control of state media and blacked out TV stations operated by the Muslim Brotherhood. The head of the Brotherhood's political wing was arrested.
The ouster of Morsi throws Egypt on an uncertain course, with a danger of further confrontation. It came after four days of mass demonstrations even larger than those of the 2011 Arab Spring that toppled longtime autocrat Hosni Mubarak.
Egyptians were angered that Morsi was giving too much power to his Muslim Brotherhood and other Islamists and had failed to tackle the country's mounting economic woes.
Beyond the fears over violence, some protesters are concerned whether an army-installed administration can lead to real democracy.
On Monday, army chief General Abdel-Fattah el-Sissi had given Morsi an ultimatum to find a solution to meet the demands of anti-government demonstrators in 48 hours, but the 62-year-old former engineer defiantly insisted on his legitimacy from an election he won with 51.7% of the vote in June 2012.
Any deal was a near impossibility, however, making it inevitable the military would move.
As the deadline approached, el-Sissi met with pro-reform leader Mohammed ElBaradei, top Muslim cleric Sheik Ahmed el-Tayeb and Coptic Pope Tawadros II, as well as opposition activists and some members of the ultraconservative Salafi movements. The consultations apparently were aimed at bringing as wide a consensus as possible behind the army's moves.
The Brotherhood boycotted the session, according to its political arm the Freedom and Justice Party.
In a last-minute statement before the deadline, Morsi again rejected the military's intervention, saying abiding by his electoral legitimacy was the only way to prevent violence. He criticized the military for "taking only one side."
"One mistake that cannot be accepted, and I say this as president of all Egyptians, is to take sides," he said in the statement issued by his office. "Justice dictates that the voice of the masses from all squares should be heard," he said, repeating his offer to hold dialogue with his opponents.
"For the sake of Egypt and for historical accuracy, let's call what is happening by its real name: Military coup," Morsi's top foreign policy adviser Essam al-Haddad wrote on his Facebook page.
After the deadline expired, el-Sissi went on state TV and said the chief justice of the Supreme Constitutional Court, Adly Mansour, would step in as interim president until new elections are held. Mansour was appointed to the court by Mubarak but elevated to the chief justice post by Morsi and will be sworn in by judges of his court.
Flanked by Muslim and Christian clerics as well as ElBaradei and two opposition activists, el-Sissi said a government of technocrats would be formed with "full powers" to run the country.
He promised "not to exclude anyone or any movement" from further steps. But he did not define the length of the transition period or when presidential elections would be held. He also did not mention any role for the military.
The constitution, drafted by Morsi's Islamist allies, was "temporarily suspended," and a panel of experts and representatives of all political movements will consider amendments, el-Sissi said. He did not say whether a referendum would be held to ratify the changes, as customary.