CAIRO — Columns of smoke rose, gunfire rattled and scores of protesters were killed early Wednesday when security forces clashed with loyalists of deposed president Mohamed Morsi in a bloody and chaotic military operation to crush two massive sit-ins.

The streets of the capital echoed with bursts of tear gas and steady streams of automatic weapons fire as security forces backed by bulldozers and armored personnel carriers stormed pro-Morsi sit-ins at Cairo University and across the Nile outside the Rabaa al Adawiya mosque.

Conflicting reports of casualty figures ranged from 40 to more than 300, according to local media reports and the Muslim Brotherhood, respectively. The death toll was expected to climb as the sit-ins turned from scenes of flag-waving protests to images reminiscent of war. The wounded and the dead were carried to a makeshift field hospital next to the Rabaa mosque, where doctors donned gas masks and floors were slippery with blood.

The raids to disperse the sit-ins began shortly before 7 a.m. local time. The smaller protest at Cairo University was cleared first as Morsi supporters, many of them followers of his Muslim Brotherhood movement, reportedly escaped through trees and into a nearby zoo. Other protesters fought police as barricades were overrun and snipers peered down from high buildings.

Police encountered more resistance at Rabaa, where thousands of supporters have been camped in what had grown into a tent city over the last six weeks. Security forces attacked the edges of the area, setting tents on fire as cars exploded, people scurried down side streets and helicopters buzzed overhead.

A Los Angeles Times reporter walked passed a dead protester, his feet drenched with blood, prayer beads and bullet casings scattered at his side. A startled security officer glimpsed the reporter and fired his weapon in her direction; she fled to safety away from the tents and toward an apartment building.

By late morning, battles had intensified around the perimeter of Rabaa. Women wailed in the distance and protesters, wearing hard hats and motorcycle helmets, rushed over a nearby bridge, taking cover behind a charred minivan and hurling rocks at police. A loudspeaker attached to an armored personnel carrier warned protesters to “leave and go back to reason.”

Banks closed, and state media reported police shut down railway service into Cairo, presumably to prevent Morsi’s Islamist supporters in the provinces from reaching the capital. Security officials were concerned that Islamist militants would begin attacking government targets in retribution and that this increasingly polarized nation would descend into factional fighting.

Media reports said pro-Morsi elements attacked public buildings and police in the cities of Alexandria and Aswan. Churches were attacked in other parts of the country, according to the Ahram Online news website.

The military-backed government had threatened for weeks to storm the camps but had several times delayed operations over fears of widespread bloodshed, including deaths of women and children. But hard-liners in the government had pressed the military and the Interior Ministry to clear the sit-ins, which had been organized by the Brotherhood.

Morsi was deposed in a coup on July 3, and supporters had vowed not to end their protests until he was reinstated. Diplomatic efforts by envoys from the U.S. and Europe failed to reach a compromise, and the Brotherhood’s leadership, many of whom have been jailed in recent weeks, refused to recognize the new government.

Millions of Egyptians have called for a crackdown on the Brotherhood and other Islamist groups. Much of the country has rallied behind Gen. Abdel Fattah Sisi, commander of the armed forces, who led the military takeover against Morsi. Officials in the largely secular new government blamed the former president for attempting to tilt the country toward Islamic law.

Authorities reported early Monday that security forces found caches of weapons at the sit-ins. The Interior Ministry’s Facebook page reported that as security forces moved to “lay siege” on the protests they “fired warning shots.”

The statement added that “some armed protesters at both sit-ins began firing shots heavily in the direction of the forces, which led to the death of one officer and a conscript and the injury of four officers and five central security recruits.”