Egypt's army has removed President Mohammed Morsi from power, suspended the constitution and pledged new elections following mass protests.
The army chief announced the move in a TV address. The head of the constitutional court is expected to be sworn in as interim leader on Thursday.
Mr Morsi's supporters denounced the move as a military coup and said he was being held in detention.
His opponents celebrated through the night in Cairo's Tahrir Square.
But officials from Mr Morsi's Muslim Brotherhood said its main rally in Cairo had come under attack by armed assailants and there were reports of deadly clashes elsewhere.
US President Barack Obama said he was "deeply concerned" by the latest turn of events and called for a swift return to civilian rule.
The military moved quickly after the TV address by army chief Gen Abdul Fattah al-Sisi, who said Mr Morsi, Egypt's first freely elected president, had "failed to meet the demands of the Egyptian people".
Military vehicles were seen fanning out across the capital.
Muslim Brotherhood media spokesman Gehad el-Haddad told the BBC that Mr Morsi had been put under house arrest and the "entire presidential team" was in detention.
Mr Haddad's father, senior Morsi aide Essam el-Haddad, and Saad al-Katatni, head of the Brotherhood's political wing, were among those held.
State-run al-Ahram newspaper reported that arrest warrants had been issued for 300 leaders and members of the Muslim Brotherhood.
TV stations belonging to the Brotherhood went off air at the end of Gen Sisi's speech and state news agency Mena said managers at the movement's Misr25 channel had been arrested.
Mr Haddad said a crowd of some 2,000 Morsi supporters had been shot at by men in civilian dress with machine guns at the main Brotherhood rally.
A notice on Mr Morsi's Facebook page denounced the army for its "military coup".
The statement asked Egyptian citizens - both civilians and military - to "abide by the constitution and the law and not to respond to this coup".
But a number of clashes were reported in several Egyptian cities. At least 10 people were said to have been killed in the coastal cities of Alexandria and Marsa Matrouh, as well as in the southern city of Minya.
In Tahrir Square, thousands of anti-Morsi protesters celebrated with fireworks and honking car horns.
One protester, Omar Sherif, told Agence France-Presse: "It's a new historical moment. We got rid of Morsi and the Muslim Brotherhood."
The BBC's Kevin Connolly in Cairo says no-one knows what will happen next. The danger, he says, is that both sides will try to settle differences by bringing supporters on to the streets.
The army has said it will not allow that to happen but, our correspondent says, it will not be easy to stop.
The army's move to depose the president followed four days of mass street demonstrations against Mr Morsi and an ultimatum issued by the military which expired on Wednesday afternoon.
Gen Sisi said in his speech that the armed forces could not stay silent and blind to the call of the Egyptian masses.
He spoke of a new roadmap for the future, and said that the chief justice of the Supreme Constitutional Court, Adli Mansour, would be given the task of "running the country's affairs during the transitional period until the election of a new president".
He is scheduled to be sworn in as head of state at 10:00 (08:00 GMT).
After Gen Sisi's address, both Pope Tawadros II - the head of the Coptic Church - and leading opposition figure Mohammed ElBaradei made short televised speeches about the new roadmap for Egypt's future which they had agreed with the army.
Mr ElBaradei said the roadmap aimed for national reconciliation and represented a fresh start to the January 2011 revolution.
"This roadmap has been drafted by honourable people who seek the interests, first and foremost, of the country," added Pope Tawadros.
Opposition leader and former Arab League chief Amr Moussa told AFP news agency that consultations for a government and reconciliation "will start from now".
Reacting to the army announcement, President Obama said he hoped to see a quick restoration of a democratically elected government in Egypt.
He ordered a review of US foreign aid to Egypt which by US law must be suspended in the event an elected leader is deposed by a military coup.
UN Secretary-General Ban Ki-moon also voiced his concern, appealing for calm and restraint in Egypt.
Mr Morsi became Egypt's first Islamist president on 30 June 2012, after winning an election considered free and fair following the 2011 revolution that toppled Hosni Mubarak.
However his term in office was marred by constant political unrest and a sinking economy.
The mass protests at the weekend that led to the army's intervention were called by the Tamarod (Rebel) movement, in response to worsening social and economic conditions.
But there has been a growing sense of discontent since last November, when Mr Morsi issued a controversial constitutional declaration granting himself extensive powers.
His moves to entrench Islamic laws and concentrate power in the hands of the Muslim Brotherhood also alienated liberals and secularists