CAIRO — The Egyptian government appeared to have lost control of the major city of Port Said on Saturday after a court sentenced 21 fans to death for their role in a deadly soccer riot, and their supporters attacked the prison where they were being held, as well as the police and court buildings.
By evening, fighting in the streets of Port Said had left at least 30 people dead, mostly from gunfire, and injured more than 300.
Fearful residents stayed in their homes. Doctors in the city said the local hospital was overloaded with casualties and pleaded for help. Water had run out in some places. Rioters attacked the Port Said power plant, and for a time closed off the main roads to the city.
A spokesman for the Interior Ministry acknowledged that its security forces were unable to control the violence and urged political leaders to try to broker a peace agreement. President Mohammed Morsi met with the National Defense Council, which includes the nation’s top military leaders, and the information minister announced that the council was considering imposing a curfew and state of emergency.
By 8 p.m., a spokesman for the Egyptian military said its troops had moved in and secured vital facilities, including the prison, the Mediterranean port, and the Suez Canal. But in telephone interviews, residents said the streets remained lawless.
‘‘I’m worried for my sister and mother,’’ said Ahmed Zangir. ‘‘I could run or do something, but it is not safe for them to get out.’’
Zangir added: ‘‘Thugs are abusing the opportunity. They are everywhere.’’
The violence that engulfed Port Said may be the sharpest challenge yet to Egypt’s new Islamist rulers as they try to reestablish public order after the two years of turmoil that have followed the end of Hosni Mubarak’s brutal autocracy.
The uprising in support of the soccer fans sentenced to death coincided with the third day of clashes between protesters and the police in Cairo and in other cities around the country, which were set off by the second anniversary of the revolt against Mubarak.
Those battles were more isolated, typically confined to clashes around symbols of government power, like the Interior Ministry headquarters in Cairo or the headquarters of the provincial government in Suez.
But by Saturday night, those clashes had killed at least 12 people, including nine in Suez Friday, state media reported.
The anniversary battles were fueled by a combination of frustration with the meager rewards of the revolution so far and hostility toward the new Islamist leaders. But the escalating chaos in Port Said arising from the soccer riot verdict posed a far greater challenge to those leaders and their promises to enforce the rule of law.
It was unclear how the fledgling government might rein in the protesters without either a brutal crackdown or a capitulation to their demands. Either alternative could further inflame the streets in Cairo and around Egypt.
‘’The solution isn’t a security solution,’’ General Osama Ismail, a spokesman for the Interior Ministry, said in a television interview. ‘‘We urge the political and patriotic leaders and forces to intervene to calm the situation.’’
The case that set off the riot grew out of a deadly brawl last February between rival groups of hard-core fans of soccer teams from Cairo and Port Said at a match in Port Said, which has about 600,000 people. The hard-core fans, called Ultras, are known for their appetite for violence against rival teams or the police. Some had smuggled knives and other weapons into the stadium, security officials said at the time.
Seventy-four people were killed and more than 1,000 injured in the soccer riot. Many died after being trampled under the stampeding crowds or falling from stadium balconies, according to forensic testimony later reported in the state media.
It was the worst soccer riot in Egyptian history and among the worst in the world. Many political figures, including members of the Morsi’s Muslim Brotherhood, initially sought to blame a conspiracy orchestrated by Mubarak loyalists or the Interior Ministry.
Prosecutors ultimately charged 21 Port Said fans with attacking their Cairo rivals, and charged nine security officers with negligence. Six of the convicted fans remain fugitives.