A court in Egypt has dropped charges against former President Hosni Mubarak over the killing of 239 protesters during the 2011 uprising against him.

The Cairo court erupted in cheers when the judge said Mubarak should not have been a defendant in the case as the charges against him were added late.

Charges against seven senior ex-officials were also dropped. The decision could be appealed.

Victims' relatives waiting outside expressed dismay and frustration.

And later police fired tear gas to disperse a crowd of about 2,000 people who gathered near Tahrir Square to voice their opposition to the decision.

In a TV interview after the ruling, Mubarak said he had done "nothing wrong at all".

The former president, 86, is serving a separate three-year sentence for embezzlement of public funds.

At the scene: BBC's Orla Guerin in Cairo

In a rare and risky act of defiance crowds gathered close to Tahrir Square, the birthplace of the 2011 revolution. It was a relatively small protest, but hugely symbolic. Both liberals and Islamists called for freedom. For some it felt - briefly - like an echo of the revolution.

The security forces moved in after a few hours, causing mayhem with teargas. We heard the crackle of live ammunition in the night air.

What happens next is a critical test for Egypt. Will the protesters try to regroup - in spite of a law banning unauthorised demonstrations? Or will the authorities manage to stamp out this this latest eruption of dissent, as they have crushed others?

Image copyrightReutersImage caption
One woman wore a T-shirt of the deposed leader

He is currently being held in a military hospital, and is expected to serve at least a few more months of this sentence.

Mubarak, his former Interior Minister, Habib al-Adly, and six others had been convicted of conspiracy to kill and were sentenced to life in prison in June 2012, but a retrial was ordered last year on a technicality.

In all, some 800 people are thought to have been killed as security forces battled protesters in the weeks before Mubarak resigned on 11 February 2011.

However, the court documents at the retrial related to the deaths of 239 people and injuries sustained by 1,588, across 11 of the country's regions.

As well as the murder charge, Mubarak was also cleared of a corruption charge involving gas exports to Israel.

His sons Gamal and Alaa were also cleared of separate corruption charges by the same court on Saturday.

Media captionThe courtroom erupted in cheers as the judge dismissed the case

As supporters cheered the verdict, his sons and co-defendants stooped down to kiss his forehead.

Later the former president gave an interview by phone to private Sada al-Balad TV.

"I did nothing wrong at all," he said, adding that he was "relying on God" as he waited for the second verdict in the case.

But relatives of those killed in 2011 reacted with anger.

"There is no justice for the poor," said Ramadan Ahmed, who lost his son Mohammed in Alexandria during the unrest, quoted by the Associated Press. "This is Mubarak's law."

Meanwhile a member of the activist group April 6th Youth Movement told the BBC that the verdict had dealt a mortal blow to the Egyptian revolution and showed that human rights in the country were not being properly defended.

"It makes [sic] a big question mark about the judiciary system in Egypt, whether it is able to... bring back the rights to other people," Mahmoud Bashar said.

Image copyrightAPImage caption
Amal Shaker with a photo of her late son Ahmed, who died in the uprising: "Youth that were like flowers were killed"

Mubarak's elected successor, President Mohammed Morsi, lasted only a year in power before being ousted by the military in July 2013 during mass anti-government protests.

Army chief Abdul Fattah al-Sisi was subsequently elected in his place and under his rule, TV stations and newspapers have largely dropped criticism of the Mubarak era, correspondents say.