Hundreds of thousands of anti-government protesters armed with flags, banners and deafening waves of chants for President Mohamed Morsi’s downfall packed into Cairo’s Tahrir Square and flooded the streets around Egypt’s presidential palace Sunday in the largest showing of opposition to the Islamist leader since he took office one year ago Sunday.

Thousands of Morsi supporters, many of them from the Muslim Brotherhood party, his ally, filled another Cairo thoroughfare with chants of support. Some brandished wooden clubs, canes and metal pipes, ready to defend themselves in the event that clashes erupted between the two camps, a scenario that many Egyptians feared was inevitable.

As night fell, violent clashes broke out between Morsi’s opponents and supporters in several cities across the country, resulting in four deaths. Attackers also stormed the Muslim Brotherhood’s Cairo headquarters, hurling molotov cocktails and setting the building on fire. Witnesses said they were met with birdshot fired from the building’s windows.

But the rival protests remained largely peaceful, despite skirmishes in the capital and across the country, bolstering confidence among those seeking to oust the president and underscoring the lingering question of how the nation of 85 million can reconcile its devastating political divide more than two years after the fall of Hosni Mubarak.

Morsi is Egypt’s first democratically elected president. But opposition protesters — a loose alliance of liberal and secular activists, old regime loyalists and a growing number of the nation’s disenchanted poor — say Morsi has lost his legitimacy during a year of political turmoil as the country’s economy has faltered and security in the streets has crumbled.

Opposition leaders say they want Morsi to resign, the Islamist-dominated elected upper house of parliament dissolved and the Islamist-­drafted constitution shelved in favor of a new round of elections and a new constitution.

The president’s supporters, most of them from the Muslim Brotherhood and other Islamist groups, accuse the opposition of challenging the democratic process and engaging in a conspiracy to oust an elected ruler.

“We’re supporting the legitimacy of an elected president,” said Azmi Sabah, a journalist at the pro-Morsi rally, where many demonstrators made the case that Egypt’s Islamists are the law-
abiding good guys.

“We are the good people of Egypt. We are doctors, lawyers and engineers,” Sabah said. Other men jumped in to say that there was no sexual harassment in their demonstration — unlike in liberal Tahrir Square — and that Islam’s prophet Muhammad protected the Jews and Christians.

But as each side sought to claim the nation’s majority, and thus the legitimacy, on Sunday, it was also apparent that the president’s supporters were vastly outnumbered. And that, political analysts said, left a resolution to Egypt’s crisis hanging in uncertainty.

“There is a good scenario, and there is a bad scenario,” said Yasser El-Shimy, an Egypt analyst for the International Crisis Group. “I think the good scenario is for the president to get the hint that his approach has failed to build a consensus so far and it needs a serious readjustment.” Ideally, the opposition would accept some sort of compromise then and recognize Morsi’s legitimacy, he said.

But the bad scenario was more likely, El-Shimy said — a scenario where “this large turnout drives the opposition to adopt maximal demands.”

Analysts say Morsi is unlikely to cede power. And the Muslim Brotherhood says such a thing is out of the question. “We are not making light of the protests or demands,” said presidential spokesman Omar Amer in a late-night news conference. But when it comes to concessions, Amer added, think again. “This is not how things are solved. Things are solved through dialogue and by coming to agreements,” he said.

But if the protests maintain their momentum and numbers, it may only make opposition leaders less willing to compromise, El-Shimy said. “And I think that will just get the country bogged down in a protracted political crisis for weeks to come.”

Anticipating serious bloodshed, some politicians and clerics warned in recent days of a looming “civil war” and urged protesters from both camps to remain peaceful.

Eight people died and hundreds were injured in clashes across the country last week. Attackers also ransacked and set fire to several Muslim Brotherhood offices in the Nile Delta.

Sporadic violence erupted Sunday, but the larger protests remained calm. Three people were killed in clashes between Morsi supporters and opponents in the southern city of Assiut, and one person was killed in Beni Suef, also in the south, according to Saad Zaghloul, an assistant to the minister of health. And a Muslim Brotherhood spokesman said Sunday night that “thugs” had attacked its Cairo headquarters. Attackers also set Brotherhood party offices in the Nile Delta ablaze.

By Sunday night, hundreds of anti-Morsi demonstrators had also scaled an outer wall that had been erected around the presidential palace by the Republican Guard. Members of the guard, inside the palace courtyard, were barely visible between cracks in the wall. But local media reports Saturday indicated that Morsi had moved to a safer presidential residence.

The police, once a symbol of Mubarak’s repressive tactics, remained conspicuously absent from the streets around the presidential palace and the Brotherhood headquarters. Some in the police have publicly refused to protect Morsi and his backers in the Muslim Brotherhood.

In a news conference last month, a spokesman for the nation’s police association said the police would not provide protection “for any party or political headquarters,” in a clear message to the Brotherhood.

In some areas of Cairo on Sunday, uniformed officers joined the protesters.

“I reject Morsi. I want him to leave,” said Hussein Ahmed Ibrahim, a police major, who stood on a corner with other officers near the palace, waving a red card that read “Leave” toward the supportive passersby who honked their car horns.

“I’ll protect the protesters, but I won’t protect the palace,” he said. “We’re all like this,” he added of the police. “And the army has the same position.”

Egypt’s military has deployed in limited areas across the country to protect government infrastructure, including the central bank and the nation’s biggest moneymaker, the Suez Canal. But soldiers were nowhere to be seen in the vicinity of Sunday’s protests, despite calls from the opposition for the military to intervene to force Morsi out.

A cacophony of cheers and air horns erupted from the anti-
government protests in Tahrir Square and near the palace Sunday, as military helicopters periodically flew overhead.

“It’s a message of friendship from the army,” said Ragai Hussein, a government bureaucrat, who was rallying against Morsi from atop one of the palace’s outer walls.

“Come down, Sissi; Morsi is not our president,” others chanted, referring to the head of Egypt’s armed forces, Abdel Fatah al-Sissi.

But if the military did anything Sunday, it was probably breathe a sigh of relief, said El-Shimy. The military has signaled that it does not want to return to the helm of politics, which it commanded — turbulently — in the first year and a half after Mubarak stepped down. But Sissi also said earlier this month that the army would step in if Egypt’s political crisis worsened.

“Depending on what happens over the next few days and potentially weeks, if the opposition is able to sustain the momentum, the military might be compelled to intervene by basically asking both sides to compromise,” El-Shimy said. “But if the protests start fading away, I doubt that the military will play a big role.”

Lara El Gibaly in Cairo contributed to this report.