At least 30 people have been killed and 250 injured in Port Said during riots sparked by a court's sentencing of 21 people to death on charges related to violent clashes between rival football fans last year.

The Egyptian army has deployed armoured personnel carriers in the coastal city after furious relatives and fans of the local Al Masry football team attacked a police station and a prison in an attempt to free some of those condemned.

The death sentences, which were announced live on television, relate to clashes in Port Said on 1 February 2012 after Cairo's Al Ahly beat the local team. Al Masry supporters attacked Al Ahly fans, causing a stampede for the exits. The police did not intervene in the violence except to switch off the stadium lights, and in the confusion the Cairo fans were crushed as crowds pushed against a locked gate which gave way under the pressure. Seventy-four people were killed.

Fans in Cairo cheered (video) as Judge Sobhi Abdel-Maguid announced the verdict while those in Port Said protested, blocking streets and attacking police, who fired teargas, rubber bullets and live ammunition into the crowds.

The death sentences must be confirmed by the grand mufti, Egypt's senior religious authority, and can also be appealed. A further 52 defendants are to be sentenced in March, including nine security officials.

Many football fans have taken a leading role in wider political protests over the past two years, often forming the vanguard of violent resistance against the police and army. Supporters of both Al Ahly and Al Masry believe former members of Hosni Mubarak's regime helped instigate the Port Said violence, and that the police were responsible for gross negligence at the very least. Some Al Masry fans claim security officials instigated or at least did nothing to stop the attack, because of long-running antipathy between the club's hardcore fans – known as Ultras – and the police.

In recent days Al Ahly fans had warned of bloodshed and retribution, and hundreds gathered outside the Cairo football club in anticipation of the verdict, chanting against the police and the government.

But after the verdict a carnival atmosphere reigned. "I feel very happy, very relieved," said Al Ahly fan Salha el-Deen, holding a sign that read: "Congratulations on your execution, Port Said." He added: "I thank the judiciary for this very fair decision."

"What happened a year ago was very sad," said another fan, Bas, who would not give his surname. "Today is a turning point, a new dawn for everyone."

But some Al Ahly fans were still furious at the failure to convict any senior security officials. "We are angry, but hope more will be convicted in the future," said one who did not give his name.

The lawyer of one of the defendants sentenced to death said the verdict was nothing more than "a political decision to calm the public".

"There is nothing to say these people did anything and we don't understand what this verdict is based on," said Mohammed al-Daw, a Port Said resident.

The verdict comes after a day of deadly clashes between security forces and protesters opposed to Egypt's Islamist president, Mohammed Morsi. The clashes continued into Saturday morning in several Egyptian cities as thousands of demonstrators protested against Morsi, the Muslim Brotherhood and police brutality on the second anniversary of the start of the revolution that forced Mubarak from power.

The military was also deployed overnight in the city of Suez after eight people died in clashes between security forces and protesters opposed to Morsi.

At least 379 people were injured across the country on Friday as riots broke out in Cairo's Tahrir Square and cities including Alexandria, Mahalla, and Ismailia. Police fired teargas across much of central Cairo and protesters pelted them with stones, bringing parts of the city's road and metro networks to a standstill.

Morsi cancelled a trip to Ethiopia on Saturday to focus on dealing with the violence.