Egyptians are braced for new violence after at least 51 supporters of the deposed president Mohamed Morsi were killed by security forces in what the Muslim Brotherhood condemned as a massacre, but the military insisted was the result of an armed attack on a Cairo barracks.

Hours after the country's single bloodiest incident in over a year, interim president Adly Mansour set out a timetable for amending the constitution, and for parliamentary and presidential elections for early 2014. Under the constitutional declaration by Mansour late on Monday, he would create two appointed committees to work out amendments to the Islamist-drafted constitution passed under Morsi.

A referendum on the new document would be held within four months. Elections for a new parliament would be held within two months after that, around mid-February. Once the new parliament convenes, it would have a week to set new presidential elections.

Monday's incident took place outside a Republican Guard officers' club where Morsi is rumoured to be in detention. The Brotherhood said its people were attacked during morning prayers, but the army said an attempt had been made by "a terrorist group" to storm the heavily guarded building. Emergency services confirmed 435 people were injured.

Egypt's interim presidency announced a judicial investigation into the killings, but that did not appease angry crowds, who were still massing as night fell at the nearby Rabaa al-Adawiya mosque, a focal point for pro-Morsi protests. The US said it was "deeply concerned" and called on Egypt's army to "exercise maximum restraint".

Sheikh Ahmed el-Tayeb, head of the al-Azhar mosque and the country's senior Muslim cleric, warned of the danger of "civil war" after the earlier shootings and said he was going into seclusion until violence ended and reconciliation began.

Injured victims described how shooting began hours after hundreds of thousands of people attended rival rallies for and against Morsi. The deaths blocked attempts to form a new civilian-led transitional government and fuelled already high tensions on the eve of the Ramadan holiday.

"There were dawn prayers and then I heard someone calling for help," Mohamed Saber el-Sebaei told the Guardian. "Just before we finished, the shooting started. The army units that were standing in front of the Republican Guard headquarters first started shooting teargas, then live ammunition above people's heads.

"People started to fall back and then an armoured vehicle came round the right-hand side escorted by a group of soldiers with their rifles shooting directly into the people. I was taking cover … behind some rubble and I felt something hit my head."

Initial claims that women and children were among the dead were not confirmed.

But a doctor running a field hospital called the three hours he had spent treating casualties some of the worst he had experienced in his life.

The army said an "armed terrorist group" had tried to break into the compound and attacked security forces. Two policemen and an army officer died and 40 soldiers were injured, with seven in critical condition. The army said it had arrested at least 200 people with "large quantities of firearms, ammunition and Molotov cocktails".

But many unanswered questions remained. Protesters could not agree whether the security forces fired first with teargas or live ammunition. Some were later filmed holding firearms.

The army's narrative was contradicted by testimony from residents who said at least 100 protesters, including children, fled to a nearby tower block – implying that not all of them were involved in an attack.

Heba Morayef of Human Rights Watch tweeted: "Regardless of what started [the] violence … [the] military and police have responsibility to exercise restraint and not use excessive and lethal force."

Morsi, narrowly elected a year ago, was deposed by the Egyptian military last Wednesday after mass protests led by the Tamarod (Rebellion) movement. Mansour, the head of the high constitutional court, replaced him as interim president. Morsi supporters say it was a military coup. Opponents call it a continuation of the revolution that overthrew Hosni Mubarak in 2011.

In immediate political fallout, the conservative Salafi Noor party withdrew from already faltering talks on a transitional government. "We wanted to avoid bloodshed, but now blood has been spilled. We will end all negotiations with the new authorities," it said. Political sources said Mohamed ElBaradei or Ziad Baha al-Din were likely to be named interim prime minister.

Abdel Moneim Aboul Fotouh, a moderate Islamist who left the Brotherhood last year, called on interim president Adly Mansour to step down and told al-Jazeera TV the incident was "a horrible crime against humanity and all Egyptians".

The Brotherhood's Freedom and Justice party (FJP) said it was calling "on the great Egyptian people to rise up against those who want to steal their revolution with tanks and armoured vehicles, even over the dead bodies of the people". But a spokesman clarified later that the appeal was for a "peaceful uprising". Jihadi groups in Sinai threatened "severe retaliation". Saad Amara, a senior FJP figure, said the killings were like Israeli attacks on Palestinians in Gaza and carried out by "armed criminals".

Hamdeen Sabahi, a former presidential candidate and leftist opposition leader, said the only beneficiaries were the Muslim Brotherhood and others who sought to polarise the situation and drive Egypt into civil war.

The US has been trying to defuse the crisis by brokering an agreement between the Brotherhood and the military, but Egyptian analysts and politicians say there is now no chance Morsi will be restored or that the defence minister, General Abdel Fatah al-Sisi, will resign, as the Islamists are demanding.

William Hague, the British foreign secretary, said in a statement: "It is crucial that there is a swift return to democratic processes in Egypt. All sides of the political spectrum should work together for the sake of the country's political and economic future."