as a military deadline for Morsi to yield to mass protests passed, the top army commander announced on television that the president had "failed to meet the demands of the Egyptian people".
Flanked by political and religious leaders and top generals, General Abdel Fattah al-Sisi announced the suspension of the Islamist-tinged constitution and a roadmap for a return to democratic rule under a revised rulebook.
The president of the supreme constitutional court will act as interim head of state, assisted by an interim council and a technocratic government until new presidential and parliamentary elections are held.
"Those in the meeting have agreed on a roadmap for the future that includes initial steps to achieve the building of a strong Egyptian society that is cohesive and does not exclude anyone and ends the state of tension and division," Sisi said in a solemn address broadcast live on state television.
After he spoke, hundreds of thousands of anti-Morsi protesters in central Cairo's Tahrir Square erupted into wild cheering, setting off fireworks and waving flags. Cars drove around the capital honking their horns in celebration.
Fireworks light the sky moments after Egypt's military chief says the president is replaced by chief justice of constitutional court outside the presidential palace in Cairo, Egypt. (AP Photo)
But a statement published in Morsi's name on his official Facebook page after Sisi's speech said the measures announced amounted to "a full military coup" and were "totally rejected".
The Arab world's most populous nation has been in turmoil since the fall of autocrat Hosni Mubarak as Arab Spring uprisings took hold in early 2011, arousing concern among allies in the West and in Israel, with which Egypt has a 1979 peace treaty.
The Muslim Brotherhood president, in office for just a year, was at a Republican Guard barracks surrounded by barbed wire, barriers and troops, but it was not clear whether he was under arrest. The state newspaper Al-Ahram said the military had told Morsi at 7pm (1700 GMT) that he was no longer head of state.
An image grab taken from Egyptian state TV shows the leader of Egypt's Coptic Christians Pope Tawadros II delivering a statement on July 3, 2013, following the announcement of the ousting of Islamist President Mohamed Morsi. (AFP Photo)
"Terrorists and fools"
Military chiefs, vowing to restore order in a country racked by protests over Morsi's Islamist policies, earlier issued a call to battle in a statement headlined "The Final Hours". They said they were willing to shed blood against "terrorists and fools".
Armored vehicles took up position outside the state broadcasting headquarters on the Nile River bank, where soldiers patrolled the corridors and non-essential staff were sent home.
In another show of force, several hundred soldiers with armored vehicles staged a parade near the presidential palace, and security sources said Morsi and the entire senior leadership of his Muslim Brotherhood were banned from leaving the country.
Security sources told Reuters the authorities had sent a list of at least 40 leading members of the Brotherhood to airport police.
In a last-ditch statement a few minutes before the deadline, Morsi's office said a coalition government could be part of a solution to overcome the political crisis. But opposition parties refused to negotiate with him and met instead with the commander of the armed forces.
Army soldiers stand guard in front of protesters who are against Egyptian President Mohamed Morsi, near the Republican Guard headquarters in Cairo. (Reuters photo)
The Brotherhood's Egypt25 television station had broadcast live coverage of a rally of tens of thousands of Morsi supporters, even as the army moved tanks into position to prevent them from marching on the presidential palace or the Republican Guard barracks.
US oil prices rose to a 14-month high above $100 a barrel partly on fears that unrest in Egypt could destabilize the Middle East and lead to supply disruption.
The massive anti-Morsi protests showed that the Brotherhood had not only alienated liberals and secularists by seeking to entrench Islamic rule, notably in a new constitution, but had also angered millions of Egyptians with economic mismanagement.
Tourism and investment have dried up, inflation is rampant and fuel supplies are running short, with power cuts lengthening in the summer heat and motorists spending hours fuelling cars.
Earlier, Morsi's spokesman said it was better that he die in defense of democracy than be blamed by history.
"It is better for a president, who would otherwise be returning Egypt to the days of dictatorship, from which God and the will of the people has saved us, to die standing like a tree," spokesman Ayman Ali said, "Rather than be condemned by history and future generations for throwing away the hopes of Egyptians for establishing a democratic life."
Female protesters against Egyptian President Mohamed Mursi hold up shoes during a gathering at Tahrir Square in Cairo. (Reuters photo)
Liberal opponents said a rambling late-night television address by Morsi showed he had "lost his mind".
The official spokesman of the Muslim Brotherhood said supporters were willing to become martyrs to defend Morsi.
"There is only one thing we can do: we will stand in between the tanks and the president," Gehad El-Haddad told Reuters at the movement's protest encampment in a Cairo suburb that houses many military installations and is near the presidential palace.
The country's two main religious leaders, the head of the Al-Azhar Islamic institute and the Coptic Pope, both expressed their support for the army's roadmap in speeches after Sisi, as did the main liberal opposition leader, Nobel peace laureate Mohamed ElBaradei.
Morsi supporters vent anger at army statement
Egypt political upheaval to deepen economic crisis
For Obama, tricky diplomatic geometry in democratic Egypt