CAIRO — Tens of thousands of supporters of Egypt’s deposed Islamist president rallied in street battles across Cairo on Friday, hurling rocks and fireworks and clashing with security forces in the first major show of defiance against what they have termed an illegal military coup.

Civilians attacked one another with chunks of asphalt, used corrugated metal sheets as shields and set fire to a car in scenes reminiscent of the chaotic street fights that accompanied the revolt that toppled longtime dictator Hosni Mubarak in early 2011.

As night fell in Cairo and military helicopters circled the capital, supporters and opponents of ousted President Mohammed Morsi battled on the bridges and overpasses leading to Tahrir Square, the heart of the protests that preceded Morsi’s removal Wednesday. Throngs of young men who support Morsi fought for more than an hour with anti-Morsi civilians for control of the Sixth of October Bridge over the Nile River in the heart of Cairo.

So chaotic and fast-moving were events that Egyptian television news broadcasters split their screens into not two, but often three, competing scenes of violent unrest.

The mayhem capped a day full of massive and defiant protests by Islamists demanding Morsi be returned to power. At least four people were killed and many were wounded when security forces fired into a protest near the officers’ club of the powerful Republican Guard, where many believed Morsi was detained.

With clashes breaking out late into the night, it was impossible to estimate the extent of casualties and damage. But early Saturday, security officials said at least 30 people had been killed nationwide and hundreds wounded, many of them in Cairo.

Islamists in other cities also demanded Morsi’s reinstatement, breaking into government offices in several provinces and temporarily evicting military officials. Fifteen people died in Alexandria, and a curfew was declared in the Sinai Peninsula, where six soldiers and police officers were killed in at least four attacks on security posts.

The new violence suggested that the military’s removal of Morsi, the country’s first freely elected president, after protests by millions of Egyptians angry with his rule, had worsened the deep polarization between Islamists who call his ouster a military coup and their opponents who say his removal was the result of an urgent need to fix Egypt’s myriad problems.

By turning out in the tens of thousands, the pro-Morsi demonstrators underlined the organizational might of the Muslim Brotherhood, which emerged as the major political force and dominated rounds of elections after the country’s revolution two years ago. At that time, it gained power that many in the group had dreamed of for decades. The military’s intervention in politics this week removed it from the government. The group called the protests the “Friday of Rejection.”

The Brotherhood’s spiritual leader made a dramatic appearance Friday before supporters, denouncing “military rule” and chanting, “Our president is Mohammed Morsi.”

Supreme guide Mohammed Badie, an avuncular figure in spectacles who delivered an impassioned address, was thought to have been under military arrest, but he declared those reports “a lie.”

It wasn’t immediately clear whether he hadn’t been arrested or whether he had been released by the military, which is eager to show the Brotherhood’s legions of supporters that its coup was based on Morsi’s inability to overcome divisions in society rather than because it held antipathy toward the Brotherhood.

Badie spoke to a crowd in Nasr City, part of east Cairo, in what was the Islamist camp’s largest gathering since Morsi’s removal. Over the previous week, anti-Morsi demonstrators had overwhelmed his supporters with their numbers and fervor, and Muslim Brotherhood members had seemed stunned by the coup and the announcement of arrest warrants against them.

But on Friday, the Islamist camp appeared re-energized. Badie’s speech featured the Brotherhood’s favored nationalist-religious rhetoric, reminding Egyptians that they stood with them through Mubarak’s three decades of authoritarian rule.

“Give Egypt back to its people,” Badie said as the crowd cheered. “Give its presidency back to Mohammed Morsi and bring an end to military rule.”

The army has said it won’t reimpose military rule — as it did after Mubarak’s ouster — but it hasn’t set a date for parliamentary or constitutional elections.

But Friday’s violence raised the prospect that the Egyptian military might intervene more forcefully to restore order or might crack down more heavily on the Muslim Brotherhood if its leaders are believed to have incited the attacks.

In a further affront to the Islamists, the group’s strongman and deputy chief, Khairat el-Shater, was arrested Friday, according to the interior ministry. Islamist leader Hazem Salah Abu Ismail and his brother were also reported to have been arrested, on charges of instigating the killing of anti-Morsi protesters. Abu Ismail has a large following among Salafists, and his arrest could mobilize angry followers of the puritanical Islamist movement, analysts said.

The interim president, Adly Mansour, further consolidated his power Friday by dissolving Egypt’s Islamist-dominated upper house of Parliament, state television reported. The Shura Council had taken up legislative powers after a court order dissolved the lower house last year.

Underpinning the Islamists’ fears of the emerging political order was a keen awareness of the long history of enmity with the security services. While some Islamists did use violence against the state, Egypt’s previous rulers kept their power in check by banning their organizations and subjecting their members to arbitrary arrests and torture.

For some, those memories have come flooding back.

“They hung me up, they beat me, they used electricity — all the means of torture they had,” said Hussein Nada, 43, a protester, recalling the eight years he spent in prison for his association with the Gamaa al-Islamiyya, a radical Islamist group that attacked tourists in the 1990s but later renounced violence.

“Anyone from the opposition who came to power could decide to put us all back in prison,” he said. “As soon as the army came back, they put hundreds on the arrests list, so we fear we could lose all we’ve gained.”

Compiled from Los Angeles Times, The New York Times and The Washington Post.