An Egyptian court has sentenced ex-President Hosni Mubarak to life in prison for complicity in the killing of protesters during last year's uprising.
The 84-year-old is the first former leader to be tried in person since the start of the Arab Spring in early 2011.
Former Interior Minister Habib al-Adly also received a life sentence over the deaths of demonstrators.
Mubarak and his two sons - Gamal and Alaa - were acquitted on separate charges of corruption.
Shouting and scuffles erupted in court after the verdict was read out.
Correspondents say some people were angry with the court's decision to acquit four senior aides to Adly, who were also widely blamed for the death of protesters
Outside the building, Mubarak's sentencing was greeted by celebrations from relatives of those killed, according to the BBC's Yolande Knell.
Firecrackers were set off. Soha Saeed, the wife of one of the victims, shouted: "I'm so happy. I'm so happy."
But the joy soon turned into angry shouts as the crowd learned that the former interior minister's aides had been cleared.
Protesters clashed with riot police. The verdict also sparked angry demonstrations in Suez.
In his preamble, Judge Ahmed Refaat insisted the 10-month trial had been a fair one.
He spoke of the Mubarak era as "30 years of darkness" and praised what he called "the sons of the nation who rose up peacefully for freedom and justice".
Announcing the verdicts, the judge then said Mubarak and Adly had failed to stop security forces using deadly force against unarmed demonstrators.
Mubarak, who ruled the country from 1981 to 2011, had faced a possible death sentence over the killing of about 850 protesters.
Egypt's state TV said Mubarak was set to be moved to the hospital of Tora prison, near Cairo, where a number of figures from the former government are serving jail sentences for corruption.
Since his trial began last August, Mubarak has been held in the International Medical Centre outside the capital, as his lawyer said he was in poor health.
Despite their acquittal, Alaa and Gamal Mubarak are to remain in detention.
On Wednesday, prosecutors said they would go on trial with seven others on charges of stock market manipulation.
The verdict comes as political tensions are rising in Egypt between two rounds of voting in a presidential election.
Our correspondent says many of Egypt's young revolutionaries are bitterly disappointed by the choice they now face - between a Muslim Brotherhood candidate, Mohammed Mursi and Mubarak's last Prime Minister, Ahmed Shafiq.
The first leader toppled during the Arab Spring was Zine al-Abidine Ben Ali of Tunisia, who was found guilty in absentia of drugs and gun charges in July.
Libyan leader Muammar Gaddafi was killed by rebels in October. Yemen's Ali Abdullah Saleh received immunity from prosecution after handing over power in November.