Egypt's armed forces overthrew elected Islamist President Mohamed Mursi on Wednesday and announced a political transition with the support of a wide range of political, religious and youth leaders.
After a day of drama in which tanks and troops deployed near the presidential palace as a military deadline for Mursi 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-Mursi 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.
But a statement published in Mursi'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 Mursi at 7pm local time that he was no longer head of state.
Military chiefs, vowing to restore order in a country racked by protests over Mursi'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".
Armoured 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 armoured vehicles staged a parade near the presidential palace, and security sources said Mursi 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, Mursi'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.
The Brotherhood's Egypt25 television station had broadcast live coverage of a rally of tens of thousands of Mursi 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 destabilise the Middle East and lead to supply disruption.
The massive anti-Mursi 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, Mursi's spokesman said it was better that he die in defence 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."
Liberal opponents said a rambling late-night television address by Mursi showed he had "lost his mind".
The official spokesman of the Muslim Brotherhood said supporters were willing to become martyrs to defend Mursi.
"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.