Egypt was locked in a tense standoff on Monday after millions of protesters swarmed into the streets to demand the resignation of Islamist President Mohammed Morsi and militants set the ruling Muslim Brotherhood's headquarters on fire.

Young revolutionaries united with liberal and leftist opposition parties in a massive show of defiance on the first anniversary of Morsi's inauguration on Sunday, chanting "the people demand the fall of the regime."

The demonstrations, which brought half a million people to Cairo's central Tahrir Square and a similar crowd in the second city, Alexandria, were easily the largest since the Arab Spring uprising that ousted Hosni Mubarak in 2011.

After dawn on Monday, young men were still preventing traffic entering Tahrir Square but only hundreds of people remained, some resting under makeshift awnings.

Morsi, the most populous Arab state's first freely elected leader, stayed out of sight throughout the protests but acknowledged through a spokesman that he had made mistakes while adding that he was working to fix them and was open to dialogue. He showed no sign of quitting.

An aide to Morsi said he was "encouraged" that events had unfolded mostly peacefully: "This is another day of democratic practice that we all cherish," he said in a statement.

He accused the opposition of being vague in its demands and outlined three ways forward: first, parliamentary elections, which he called "the most obvious"; second, national dialogue, which he said opponents had repeatedly rejected; and third, early presidential elections, as demanded by protesters. But that, he said, "simply destroys our democracy."

The massive protests showed that the ruling Muslim Brotherhood has not only alienated liberals and secularists by seeking to entrench Islamic rule but has also angered millions of ordinary Egyptians with economic mismanagement.

Tourism and investment have dried up, inflation is rampant and fuel supplies are running short, with power cuts lengthening in the summer heat.

Dozens of militants attacked the Brotherhood's national headquarters in Cairo with shotguns, petrol bombs and rocks, setting it on fire, and targeted offices of its political party across the country.

There was no sign of police or fire service protection for the Brotherhood's head office, where witnesses said guards inside the building fired on the attackers. Two people died and 11 were injured in that clash, hospital sources said.

Protest organizers called on Egyptians to keep occupying central squares across the country in a campaign of peaceful civil disobedience until Morsi quits.

Tens of thousands of demonstrators stayed in Tahrir Square long after midnight, appearing to heed the call for a sit-in. But as the working day began, only hundreds remained.

If protesters maintain their camps, however, and return in the evenings, the spotlight will be on the army. It displayed its neutrality on Sunday, making goodwill gestures to the protesters after urging feuding politicians last week to cooperate to solve the nation's problems.

Some uniformed policemen marched among protesters in Cairo and Alexandria, chanting "the police and the people are one," and several senior officers addressed the Tahrir Square crowd.

That cast doubt on whether Morsi could rely on the security forces to clear the streets if he gave the order.

Diplomats said the army, which ruled uneasily during the transition from Mubarak's fall to Morsi's election, had signaled it was deeply reluctant to step in again, unless violence got out of hand and national security was at stake.

While the main demonstrations were peaceful and festive in atmosphere, seven people were shot dead in clashes in the central cities of Assiut, Beni Suef and Fayoum and outside the Brotherhood's Cairo headquarters. The Health Ministry said 613 people were wounded in street fighting around the country.

Women's activists said at least 43 women, including a foreign journalist, suffered organized sexual assaults by gangs of men during the Tahrir Square rally.

The opposition National Salvation Front coalition of liberal, secular and left-wing parties declared victory, saying the masses had "confirmed the downfall of the regime of Mohamed Morsi and the Muslim Brotherhood."

Opposition leaders, who have seen previous protest waves fizzle after a few days in December and January, were to meet on Monday afternoon to plot their next move.

Influential Qatar-based Muslim cleric Sheikh Youssef Qaradawi, visiting Cairo, appealed to fellow Egyptians to show more patience with Morsi, while saying the president had made errors.

"How long has Mohamed Morsi ruled? One year," Qaradawi said in a television address. "Is one year enough to solve the problems of 60 years? That's impossible ... We must give the man a chance and help him. Everyone must cooperate."

The United States and the European Union have urged Morsi to share power with the opposition, saying only a national consensus can help Egypt overcome a severe economic crisis and build democratic institutions.

Morsi and his Brotherhood supporters have so far rebuffed such pressure, arguing that he has democratic legitimacy and the opposition is merely seeking to achieve on the streets what it failed to secure at the ballot box.