Egypt's army overthrew elected President Mohamed Mursi, delighting millions who hated Islamist rule but incensing his supporters, who saw a military coup that poses dilemmas for Western leaders who promote democracy.
Mursi, elected a year ago in a vote hailed as a new dawn for the Arab world's biggest nation after the uprising of 2011, was held at a military facility in Cairo, a security source said.
Earlier, in a shaky, handheld video, and in a Facebook post he denounced "a full military coup" that would plunge Egypt into "chaos." But he urged his supporters not to fight back.
The head of the armed forces pledged new elections as part of a road map ironed out during a meeting with liberal opposition groups before Mursi's removal was announced. Liberals welcomed a relaunch of the transition to democracy, which they felt had been hijacked by Mursi's Muslim Brotherhood.
Military authorities immediately shut down television channels seen as sympathetic to the Muslim Brotherhood and began arresting other senior leaders.
Vast crowds partied in Cairo's Tahrir Square, recalling the Arab Spring revolution two years ago when the army toppled the autocrat Hosni Mubarak. But in clashes after dark across the country, at least 14 people were killed and over 340 wounded.
The fall of the first elected leader to emerge from the Arab Spring revolutions of 2011 raised questions about the future of political Islam, which had seemed triumphant. Deeply divided, Egypt's 84 million people find themselves again a focus of concern in a region traumatized by the civil war in Syria.
Straddling the Suez Canal and a key piece in the security of Israel, many powers have an interest in Egypt's stability.
The army put combat troops and tanks on streets around a gathering of thousands of Mursi's supporters in Cairo. It said it would keep order across the country.
Within a couple of hours of the broadcast by military chief General Abdel Fattah al-Sisi, suspending the constitution and appointing the constitutional court's chief justice as interim head of state, three TV channels went off air. The Egyptian arm of Qatar's Al Jazeera was raided but kept transmitting.
The head of the political wing of Mursi's Muslim Brotherhood - the speaker of a disbanded parliament - was arrested at his home. State newspaper Al-Ahram said warrants were issued for 300 Brotherhood members accused of inciting unrest.
United Nations Secretary-General Ban Ki-moon urged a swift return to civilian rule, restraint and respect for civil rights.
U.S. President Barack Obama, whose administration provides $1.3 billion a year to the Egyptian military, expressed deep concern about Mursi's removal and called for a swift return to a democratically elected civilian government. But he stopped short of condemning a military move that could block U.S. aid.
"During this uncertain period, we expect the military to ensure that the rights of all Egyptian men and women are protected, including the right to peaceful assembly, due process, and free and fair trials in civilian courts," he said.
Obama urged the new authorities to avoid arbitrary arrests and said U.S. agencies would review whether the military action would trigger sanctions on aid. A senator involved in aid decisions said the United State would cut off its financial support if the intervention was deemed a military coup.
Much may depend on a strict definition of "coup."
Sisi, head of Egypt's armed forces, stressed that the army acted to enforce the will of the people. They demonstrated in the millions against Mursi this week. Sisi said the president had failed to heed their demands.
Washington's senior general, Martin Dempsey, said that if the move by Sisi, a graduate of the U.S. Army War College, was seen as a coup it would affect relations: "There will be consequences if it is badly handled," he told CNN. "There's laws that bind us on how we deal with these kinds of situations."
Concerns over human rights have clouded U.S. relations with Cairo, but did not stop aid flowing to Mubarak, or to Mursi.
The European Union, the biggest civilian aid donor to its near neighbor, also called for a rapid return to the democratic process. Foreign policy chief Catherine Ashton said in a statement that should mean "free and fair presidential and parliamentary elections and the approval of a constitution."
She did not mention the constitution and elections already held in the past two years, whose results the armed forces have now cast aside. Constitutional court president Adli Mansour was to be sworn in as head of state at 10 a.m. (0800 GMT).
The liberals' chief negotiator with the army, former U.N. diplomat Mohamed ElBaradei, said the program agreed with the generals would ensure the continuation of the revolution.
Sisi said: "Those in the meeting have agreed on a road map 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 was flanked by his uniformed high command but also by a senior Muslim cleric, the pope of Egypt's Coptic Church and political leaders ranging from liberals to a bearded Islamist representative from the ultra-Islamic Nour Party. Also present were youth leaders who were given special mention by Sisi.
Reflecting the hopes of the "revolutionary youth" who led the charge against Mubarak, only to see the electoral machine of the Brotherhood dominate the new democracy, the young man who proved Mursi's extraordinary nemesis said the new transitional period must not repeat the mistakes of the recent past.
"We want to build Egypt with everyone and for everyone," said Mahmoud Badr, a 28-year-old journalist who first had the idea two months ago for a petition calling on Mursi to resign. By last weekend, the "Tamarud - Rebel!" movement was claiming 22 million backers, many of whom were on the streets on Sunday.
The army had already grown increasingly alarmed about Mursi dragging Egypt into the sectarian conflict in Syria and the turnout on the streets gave Sisi his justification for handing the president a 48-hour deadline to share power or lose it.
His overthrow may have repercussions in Tunisia, whose uprising prompted Egyptians to take on Mubarak, the last in a 60-year line of military-backed rulers. Tunisia now has its own "Tamarud" movement, seeking to end Islamist government.
On Tahrir Square, cradle of Egypt's January 25 Revolution in 2011, huge crowds in the hundreds of thousands set off fireworks and partied, chanting: "The people and the army are one hand!"
The past four days have seemed to many like a fast-motion rerun of the 18 days that brought down Mubarak, when the army that had long backed him realized his time was up.
Sisi announced a technocratic government will rule until new presidential and parliamentary elections are held - no time frame was set. The constitution will be reviewed by a panel representative of all sections of society. Media freedoms, under threat during Mursi's rule, would be protected.
That did not seem to prevent the shutdown of three channels, including one owned by the Brotherhood, and the arrest of a staffer at Egypt's Al Jazeera Mubasher, owned by the Gulf state of Qatar. The emirate is seen as close to the movement.
Saudi Arabia, in contrast, has long been suspicious of the Brotherhood's international ambitions. King Abdullah sent a message of congratulations to the man replacing Mursi. The United Arab Emirates also welcomed the change in Cairo.
U.S. 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-Mursi protests showed that the Brotherhood had not only alienated liberals and secularists by seeking to entrench Islamist rule, notably in the new constitution. But it 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.
With Egypt's economy left ragged by the unrest of the past two and half years, Mursi had been helped by gifts and loans from Qatar. The new authorities may hope for help from other quarters. Notably, an IMF loan has long been stalled.
The official spokesman of the Muslim Brotherhood said supporters were willing to become martyrs to defend Mursi.
But the Brotherhood also has an 85-year history of survival and may take a long view of whether it is better to draw in its horns and watch others try to reform Egypt's sclerotic economy.
A Brotherhood official, Gamal Heshmat, told Reuters: "There is absolutely no direction towards violence. The Brotherhood are not raised on violence. Their cause is a peaceful one, defending their rights, which is stronger than a military coup."
A colleague, Osama Gado, spoke by telephone from the square where thousands of Mursi supporters were gathered: "I am afraid to leave the square because I fear I could get arrested."