At least 51 people were killed on Monday when the Egyptian army opened fire on supporters of ousted president Mohamed Morsi, in the deadliest incident since the elected Islamist leader was toppled by the military five days ago.
Protesters said shooting started as they performed morning prayers outside the Cairo barracks where Morsi is believed to be held.
But military spokesman Ahmed Ali said that at 4 a.m. armed men attacked troops in the area around the Republican Guard compound in the northeast of the city.
"The armed forces always deal with issues very wisely, but there is certainly also a limit to patience," the uniformed Ali told a news conference, at which he presented what he said was video evidence, some of it apparently taken from a helicopter.
Emergency services said 435 people were wounded.
Morsi's Muslim Brotherhood urged people to rise up against the army, which they accuse of a military coup to topple the leader, threatening an escalation in Egypt's political crisis.
"The massacre at the Republican Guard defies description," said Mohamed El-Beltagy, a leading member of the Brotherhood's political wing, on its Facebook page.
At a hospital near the Rabaa Adawiya mosque where Islamists have camped out since Morsi was ousted, rooms were crammed with people wounded in the violence, sheets were stained with blood and medics rushed to attend to those hurt.
"They shot us with teargas, birdshot, rubber bullets - everything. Then they used live bullets," said Abdelaziz Abdel Shakua, a bearded 30-year-old who was wounded in his right leg.
As an immediate consequence of the clash, the ultra-conservative Islamist Nour party, which initially backed the military intervention, said it was withdrawing from talks to form an interim government for the transition to new elections.
A spokesman for the interim presidency, Ahmed Elmoslmany, said work on forming the government would go on, though Nour's withdrawal could seriously undermine efforts at reconciling rival factions.
The military has said that the overthrow was not a coup, and it was enforcing the will of the people after millions took to the streets on June 30 to call for Morsi's resignation.
But pro- and anti-Morsi protests took place in Cairo, Alexandria and other cities, and resulted in clashes on Friday and Saturday that left 35 dead.
It leaves the Arab world's largest nation of 84 million people in a perilous state, with the risk of further enmity between people on either side of the political divide while an economic crisis deepens.
SHOTS DURING PRAYERS
A Reuters journalist at the scene saw first aid helpers attempting mouth-to-mouth resuscitation on a dying man.
Al Jazeera's Egypt channel showed footage from inside a makeshift clinic near the scene of the violence, where Morsi supporters attempted to treat bloodied men.
Seven dead bodies were lined up in a row, covered in blankets and an Egyptian flag. A man placed a portrait of Morsi on one of the corpses.
Footage broadcast by Egyptian state TV showed Morsi supporters throwing rocks at soldiers in riot gear on one of the main roads leading to Cairo airport.
Young men, some carrying sticks, crouched behind a building, emerging to throw petrol bombs before retreating again.
Footage posted on YouTube on Monday showed a man on a rooftop wearing what appeared to be a military helmet opening fire with a rifle five times, apparently in the direction of a crowd in the street below.
In the clip, which could not be independently verified, two bloodied men were shown carried away unconscious.
State-run television showed soldiers carrying a wounded comrade along a rock-strewn road, and news footage showed a handful of men who looked like protesters firing crude handguns.
The rest of the city was for the most part calm, though armored military vehicles closed bridges over the Nile to traffic following the violence.
The military overthrew Morsi on Wednesday after mass nationwide demonstrations led by youth activists demanding his resignation. The Brotherhood denounced the intervention as a coup and vowed peaceful resistance.
Talks on forming a new government were already in trouble before Monday's shooting, after the Nour Party rejected two liberal-minded candidates for prime minister proposed by interim head of state Adli Mansour, the top constitutional court judge.
Nour, Egypt's second biggest Islamist party, which is vital to give the new authorities a veneer of Islamist backing, said it had withdrawn from the negotiations in protest at what it called the "massacre at the Republican Guard (compound)".
"The party decided the complete withdrawal from political participation in what is known as the road map," it said.
The military can ill afford a lengthy political vacuum at a time of violent upheaval and economic stagnation.
Scenes of running street battles between pro- and anti-Morsi demonstrators in Cairo, Alexandria and cities across the country have alarmed Egypt's allies, including key aid donors the United States and Europe, and Israel, with which Egypt has had a U.S.-backed peace treaty since 1979.
The violence has also shocked Egyptians, growing tired of the turmoil that began two-and-a-half years ago with the overthrow of autocrat Hosni Mubarak in a popular uprising.
In one of the most disturbing scenes of the last week, video footage circulated on social and state media of what appeared to be Morsi supporters throwing two youths from a concrete tower on to a roof in the port city of Alexandria.
The images, stills from which were published on the front page of the state-run Al-Akhbar newspaper on Sunday, could not be independently verified.
On Sunday, huge crowds numbering hundreds of thousands gathered in different parts of Cairo and were peaceful, but nonetheless a reminder of the risks of further instability.
For many Islamists, the overthrow of Egypt's first freely elected president was a bitter reversal that raised fears of a return to the suppression they endured for decades under autocratic rulers like Mubarak.
On the other side of the political divide, millions of Egyptians were happy to see the back of a leader they believed was orchestrating a creeping Islamist takeover of the state - a charge the Brotherhood has vehemently denied.
EU foreign policy chief Catherine Ashton said she deplored the loss of life: "All those who claim legitimacy must act in a responsible way for the good of the country and avoid any provocation or escalation of violence," she said in a statement.
Washington has not condemned the military takeover or called it a coup, prompting suspicion within the Brotherhood that it tacitly supports the overthrow.
President Barack Obama has ordered a review to determine whether annual U.S. assistance of $1.5 billion, most of which goes to the Egyptian military, should be cut off as required by law if a country's military ousts a freely elected leader.
Egypt can ill afford to lose foreign aid. The country appears headed for a looming funding crunch unless it can quickly access money from overseas. The local currency has lost 11 percent of its value since late last year.
On Monday, British energy firms BG Group and BP said they had pulled 160 expatriate staff out of Egypt due to spreading unrest, although operations and production were not expected to be affected.
Egypt's share index lost 3.6 percent on Monday.
Additional reporting by Shadia Nasralla, Ashraf Fahim, Asma Alsharif, Mike Collett-White, Alexander Dziadosz, Maggie Fick, Tom Finn, Sarah McFarlane, Tom; Perry, Yasmine Saleh, Paul Taylor and Patrick Werr in Cairo and Barbara Lewis in Brussels; Writing by Mike Collett-White; Editing by Alastair Macdonald