CAIRO — At least 51 people were killed and hundreds were injured as street clashes erupted in several Egyptian cities on Sunday, in a surge of violence that raised new questions about the ability of the interim government to secure the fractured country.

The death toll was the highest in a single day since mid-August, when the authorities began their crackdown on Islamist supporters of former President Mohamed Morsi, ousted by the army on July 3. The military-backed government that replaced him has tried to project an aura of stability in order to lure back the tourists and investors scared off by several years of turmoil in the country.

But on Sunday, only grim, familiar scenes of violence returned, along with the sounds of gunfire.

The bloodshed came as thousands of Egyptians celebrated the 40th anniversary of the 1973 war with Israel, setting up a day of bizarre contrasts that served as reminders of Egypt’s deepening polarization since the ouster of Mr. Morsi.

As the military’s supporters celebrated the anniversary in Tahrir Square in Cairo with music and fireworks, officers and armed civilian loyalists set upon Islamist protesters who were also trying to reach the square, driving back their marches with tear gas and gunfire.