Tens of thousands of supporters of ousted president Mohamed Morsi gathered on Friday vowing to keep fighting for his reinstatement, as rival rallies defending his overthrow underlined Egypt's bitter divisions.
The rallies come as Germany called for the release of Morsi, who is being held in a "safe place, for his safety" and has not yet been charged, according to the foreign ministry.
"We call for an end to the restrictions on Mr Morsi's whereabouts," a German foreign ministry spokesman told reporters.
With an Egyptian flag in one hand and a Koran in the other, protesters gathered outside the Rabaa al-Adawiya mosque in Cairo's Nasr City neighbourhood chanted against the military and pledged allegiance to Morsi.
"We will continue to resist. We will stay one or two months, or even one or two years. We won't leave here until our president, Mohamed Morsi, comes back," influential Islamist leader Safwat Hegazi told the crowd.
"We will stay in the square. We are free revolutionaries and we will continue our journey," he shouted.
Hegazi laid down their demands as the reinstatement of Egypt's first freely elected president, immediate parliamentary elections and a committee to oversee a plan for national reconciliation.
But despite the large turnout and defiant mood, the gathering has been increasingly out of step with political developments as the interim authorities pressed ahead with formation of a new government and Gulf states stepped in to help support the faltering economy.
The Muslim Brotherhood, the influential Islamist group from which Morsi emerged, is now in tatters with much of its leadership detained, on the run or keeping a low profile following Morsi's July 3 overthrow by the military.
The holy month of Ramadan, usually a time of communal sharing and unity, has been marked instead by anxiety after deadly clashes and uncertainty about the future.
Pro-Morsi protesters arrived from across the country to join hundreds already camped out at the Rabaa al-Adawiya mosque.
"I'm sure Morsi will return to his position. Any injustice has an end," said student Ibrahim Mohamed from the Nile Delta province of Sharqiya.
The anti-Morsi camp has also called for huge rallies after Friday prayers, in Tahrir Square and at the Ittihadiya presidential palace, with a mass iftar -- the breaking of the Muslim fast -- planned at sundown in the central plaza.
In Tahrir Square, several dozen demonstrators gathered under a scorching midday sun, adamant that the crowds would pick up later.
"It is because of the heat and Ramadan, when we have a fast. During the day, people stay at home but this evening, people will come to Tahrir," Gamal, 48, told AFP.
The rival rallies have raised fears of more of the violence that has shaken Egypt since the army removed Morsi after millions of demonstrators demanded his resignation.
In the worst violence, clashes at an army building in Cairo on Monday killed 53 people, mostly Morsi supporters.
The Brotherhood accuses the army of "massacring" its supporters, while the army says soldiers were attacked by "terrorists" and armed protesters.
The restive Sinai peninsula, home to Egypt's luxury Red Sea resorts, has been hit by a surge of violence, with militants killing a police officer in a rocket attack on a checkpoint early on Friday, security and medical officials said.
A Coptic Christian man was found decapitated on Thursday five days after being kidnapped, and on Wednesday, two people died in a militant attack on a security checkpoint in the Sinai and a police base was mortared.
Police are hunting Brotherhood chief Mohammed Badie and other senior leaders suspected of inciting deadly violence, after arrest warrants were issued on Wednesday.
The public prosecutor has pressed charges against 200 of 650 people detained during Monday's violence.
A US State Department spokeswoman said the arrests were "not in line with the national reconciliation" the interim government and military say they want, adding that if they continued "it is hard to see how Egypt will move beyond this crisis".
The German ministry spokesman said a "trusted institution" such as the International Committee of the Red Cross should be granted access to Morsi.
"We and our partners are of the opinion that any appearance of selective justice in Egypt must be avoided and there must be no political persecution," he said.
Adly Mansour, the military-appointed caretaker president, has set a timetable for elections by early next year.
But opponents and supporters of Morsi alike have criticised the interim charter he issued on Monday to replace the Islamist-drafted constitution and steer a transition that the army itself has acknowledged will be "difficult".
Many fear a repetition of the mistakes of the last military-led transition, between Hosni Mubarak's ouster in 2011 and Morsi's election in June 2012.