CAIRO (Reuters) - Millions of Egyptians flooded into the streets on the first anniversary of Islamist President Mohamed Mursi's inauguration on Sunday to demand that he resign in the biggest challenge so far to rule by his Muslim Brotherhood.
Waving national flags and chanting "Get out!", a crowd of nearly 500,000 massed in and around Cairo's central Tahrir Square in by far the largest demonstration since the 2011 uprising that overthrew Mursi's predecessor, Hosni Mubarak.
"The people want the fall of the regime!" they shouted, echoing the Arab Spring rallying cry that brought down Mubarak - this time yelling it not against an ageing dictator but against the first elected leader in Egypt's 5,000-year recorded history.
Huge protest rallies continued late into the night in a mostly festive atmosphere.
While the main protests were peaceful, five people were shot dead in clashes in the Nile valley towns of Assiut and Beni Suef and the oasis town of Fayoum. The Health Ministry said more than 200 were injured in clashes in several provincial towns.
A military source said as many as 14 million people in this nation of 84 million took part in Sunday's demonstrations in sweltering heat. There was no independent way to verify that estimate, which seemed implausibly high, but the armed forces used helicopters to monitor the crowds.
Militants hurling petrol bombs and rocks and firing shotguns attacked the Brotherhood's national headquarters in a Cairo suburb, sending flames billowing from the main entrance. There was no sign of police protection or fire fighters.
The liberal opposition National Salvation Front coalition declared victory in what it styled "Revolutionary Communique No. 1" saying the masses had "confirmed the downfall of the regime of Mohamed Mursi and the Muslim Brotherhood".
Mursi's official spokesman, Omar Amer, said the president had admitted mistakes and was in the process of fixing them. He repeated Mursi's offer of dialogue but made clear he had no intention of resigning.
Organisers called on the demonstrators to keep occupying central squares in every city until Mursi quits and to blockade the only functioning house of parliament.
The Tahrir crowd roared approval when an army helicopter hovering overhead dropped Egyptian flags on the protesters. The military source said the move was intended to encourage patriotism and was not a gesture of political support.
Many demonstrators bellowed their anger at the Brotherhood, which they accuse of hijacking Egypt's revolution and using electoral victories to monopolise power and impose Islamic law.
Others, including some who said they had voted for Mursi, have been alienated by a deepening economic crisis and worsening personal security, aggravated by a political deadlock over which he has presided.
The veteran leaders of Egypt's secular, liberal and left-wing opposition, including former chief of the U.N. nuclear watchdog Mohamed ElBaradei and leftist presidential candidate Hamdeen Sabahi, joined protest marches in Cairo.
Hundreds of thousands of protesters marched through the Mediterranean port of Alexandria, Egypt's second city, and large protests were reported in at least 20 towns around the country.
Mursi, an engineering professor propelled from obscurity to power by the Brotherhood, monitored events from the heavily guarded Qubba presidential palace but did not appear in public.
A senior Brotherhood politician, Essam El-Erian, denounced the protests as a "coup attempt".
In a statement on the group's website, he challenged the opposition to test public opinion in parliamentary elections instead of "simply massing people in violent demonstrations, thuggery or shedding the precious blood of Egyptians".
The leader of the second largest Islamist party, Younis Makhyoun of the Salafist Nour party, urged Mursi to make concessions to avert bloodshed and presented himself in an interview with Reuters as a potential mediator.
Security sources said demonstrators targeted offices of the Brotherhood and its political party across the country after a week of sporadic violence in which hundreds of people have been hurt and several killed, including an American student.
Tens of thousands of Mursi supporters congregated outside a Cairo mosque not far from the main presidential palace but made no contact with the anti-government protesters.
Interviewed by a British newspaper, Mursi voiced his resolve to ride out what he sees as an undemocratic attack on his electoral legitimacy. He offered to revise the Islamist-inspired constitution, saying clauses on religious authority, which fuelled liberal resentment, were not his choice.
He made a similar offer last week, after the head of the army issued a strong call for politicians to compromise. But the opposition dismissed it as too little too late. They hope Mursi will resign in the face of the large numbers on the streets.
Some Egyptians believe the army may force the president's hand, if not to quit then at least to make substantial concessions to the opposition.
Chief-of-staff and Defence Minister General Abdel Fattah al-Sisi was following the situation from a special operations room, the military source said.
In Cairo, marchers stopped to shake hands and take pictures with soldiers guarding key buildings. At least six high-ranking police officers took to the Tahrir Square podium in support of the demonstrators, a Reuters witness said.
Mursi and the Brotherhood hope the protests will fizzle as previous outbursts did in December and January. If not, some form of compromise, possibly arbitrated by the army, may be on the cards.
Both sides insist they plan no violence but accuse the other - and agents provocateurs from the old regime - of planning it.
The U.S.-equipped army shows little sign of wanting power but warned last week it may have to step in if deadlocked politicians let violence slip out of control.
U.S. President Barack Obama called for dialogue and warned that trouble in the most populous Arab nation could unsettle an already turbulent region. Washington has evacuated non-essential personnel and reinforced security at diplomatic missions.
In his interview with Britain's Guardian newspaper, Mursi repeated accusations that what he sees as entrenched interests from the Mubarak era are plotting to foil his attempt to govern. He dismissed the demands that he give up and resign.
If that became the norm, he said, "well, there will be people or opponents opposing the new president too, and a week or a month later, they will ask him to step down".
Liberal leaders say nearly half the voting population - 22 million people - has signed a petition calling for new elections, although there is no obvious challenger to Mursi.
Religious authorities have warned of "civil war".
The army, half a million strong and financed by Washington since it backed a peace treaty with Israel three decades ago, says it has deployed to protect key installations.
Among these is the Suez Canal. Cities along the waterway vital to global trade are bastions of anti-government sentiment. A bomb killed a protester in Port Said on Friday. A police general was gunned down in Sinai, close to the Israeli border.
Reporting by Asma Alsharif, Alexander Dziadosz, Shaimaa Fayed, Maggie Fick, Alastair Macdonald, Shadia Nasralla, Tom Perry, Yasmine Saleh, Paul Taylor and Patrick Werr in Cairo; Yusri Mohamed in Ismailia and Abdelrahman Youssef in Alexandria.; Writing by Alastair Macdonald and Paul Taylor; Editing by Peter Graff and Christopher Wilson