Egypt's prosecutor ordered the arrest of the Muslim Brotherhood's leader on Thursday, widening a crackdown against the Islamist movement after the army ousted the country's first democratically elected president.
The dramatic exit of President Mohamed Mursi was greeted with delight among millions of people on the streets of Cairo and other cities overnight, but there was simmering resentment among Egyptians who opposed military intervention.
Perhaps aware of the risk of a polarised society, the new interim leader, Adli Mansour, used his inauguration to hold out an olive branch to the Brotherhood.
"The Muslim Brotherhood are part of this people and are invited to participate in building the nation as nobody will be excluded, and if they respond to the invitation, they will be welcomed," he said.
Mursi's removal after a year in office marked another twist in the turmoil that has gripped the Arab world's most populous country in the two years since the fall of Hosni Mubarak.
The United Nations, the United States and some other world powers did not condemn Mursi's removal as a military coup. To do so might trigger sanctions.
Army intervention was backed by millions of Egyptians, including liberal leaders and religious figures who expect new elections under a revised set of rules.
The protest movement that sealed Mursi's fate was rooted in a liberal opposition that lost elections to Islamists, but its ranks were swelled by anger over broken promises on the economy, shrinking real incomes and lengthening lines for fuel.
The downfall of Egypt's first elected leader to emerge from the Arab Spring revolutions raised questions about the future of political Islam, which only lately seemed triumphant.
Deeply divided, Egypt's 84 million people find themselves again a focus of concern in a region traumatised by the civil war in Syria.
At least 16 people have been killed and hundreds wounded in street clashes across Egypt since Mursi's overthrow, and television stations sympathetic to Mursi were taken off air.
Mursi himself was in military custody, army and Brotherhood sources said, and judicial authorities have opened an investigation into accusations that he and 15 other Islamists insulted the judiciary.
The prosecutor's office also ordered the arrest of the Brotherhood's top leader, Mohamed Badie, and his deputy Khairat el-Shater, according to judicial and army sources.
The two men have been charged with inciting violence against protesters outside the Brotherhood's headquarters in Cairo that was attacked on Sunday night.
A senior Brotherhood politician, Essam El-Erian, said the movement would take a long view of the political setback.
Writing on Facebook, he said "waves of sympathy" for the Brotherhood would rise gradually over time and that the country's Islamist leaders were overthrown before they had a chance to succeed.
"The end of the coup will come faster than you imagine," he added.
Mohamed El-Beltagy, a senior Brotherhood politician, said the movement was unlikely to take up arms over what he called a military coup, although he warned that other, unnamed, groups could be pushed to violent resistance by recent events.
Outside the constitutional court where Mansour was sworn in, 25-year-old engineer Maysar El-Tawtansy summed up the mood among those who had voted for Mursi in the 2012 poll and opposed military intervention.
"We queued for hours at the election, and now our votes are void," he said. "It's not about the Brotherhood, it's about Egypt. We've gone back 30, 60 years. Now the military rules again. But freedom will prevail."
For the defeated Islamists, the clampdown revived memories of their sufferings under the old, military-backed regime led by Hosni Mubarak, himself toppled by a popular uprising in 2011.
There was a call from calm from the influential Dawa Salafiya movement of Egyptian Salafists, urging Islamists to "leave the squares to go to their mosques and homes."
But a smaller Salafist group, the El-Asalah Party, posted on its website the locations in Cairo and other cities where its followers should gather in the afternoon in support of Mursi.
The clock started ticking for Mursi when millions took to the streets on Sunday to demand he resign. They accused his Brotherhood of hijacking the revolution, entrenching its power and failing to revive the economy.
That gave armed forces chief General Abdel Fattah al-Sisi, who already had his own reservations about the state of the nation under Mursi, a justification to invoke the "will of the people" and demand the president share power or step aside.
The United States and other Western allies had also pressed Mursi hard to open his administration to a broader mix of ideas.
Sisi, in uniform and flanked by politicians, officers and clergy, called on Wednesday for measures to wipe clear a slate of messy democratic reforms enacted since Mubarak fell. The constitution was suspended.
A technocratic interim government will be formed, along with a panel for national reconciliation, and the constitution will be reviewed. Mansour said fresh parliamentary and presidential elections would be held, but he did not specify when.
Liberal chief negotiator Mohamed ElBaradei, a former UN nuclear agency chief, said the plan would "continue the revolution" of 2011.
Many liberals hope they can have more electoral success than last year, when the Brotherhood's organisation dominated the vote. But its own ability to fight back democratically may be limited by the arrests of its leaders.
Straddling the Suez Canal and Israel's biggest neighbour, Egypt's stability is important for many powers.
U.S. President Barack Obama, whose administration provides $1.3bn a year to the Egyptian military, expressed 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 US aid.
A senator involved in aid decisions said the United States would cut off its financial support if the intervention was deemed a military coup.
Israel avoided any show of satisfaction over the fall of an Islamist president who alarmed many in the Jewish state but who quickly made clear he would not renege on a peace treaty.
German Foreign Minister Guido Westerwelle called the latest events in Egypt "a serious setback for democracy" while NATO Secretary-General Anders Fogh Rasmussen said he was "gravely concerned" about the situation.
The African Union said it was likely to suspend Egypt from all its activities and Turkey said the army's overthrow of Mursi constituted an "unacceptable" military coup.
But the new emir in Qatar, which has provided billions of dollars in aid to Egypt following the ousting of Mubarak, congratulated Mansour on his appointment.
The markets reacted positively to Mursi's exit. Egypt's main stock index surged to a one-month high at the opening on Thursday, gaining 6.4 percent.