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.
Ex-interior Minister Habib al-Adly also got a life sentence, but the acquittal of four high-ranking interior ministry officials sparked fury.
Huge crowds of protesters have gathered in Cairo's Tahrir Square.
Demonstrations have also been reported elsewhere.
Mubarak and his two sons were also acquitted on separate charges of corruption.
But as Mubarak was being transferred to prison, he suffered a "health crisis", Egyptian state TV reported.
Angry shouts
After the verdict was read out, scuffles erupted in court.
Outside the building, Mubarak's sentencing was initially greeted by celebrations from relatives of those killed, according to the BBC's Yolande Knell.
But the joy soon turned into angry shouts and protesters clashed with riot police as the crowd learned that four high-ranking interior ministry officials, including former deputy interior minister and head of state security, Hassan Abd El Rahman, had been acquitted. Two other regional directors of security were also acquitted.
There have been several calls for demonstrations. Immediately after the announcement, crowds gathered in Cairo's Tahrir Square, which was a leading focus in the protests that toppled Mr Mubarak. There were also protests in Suez and Mansoura.
As Mubarak was being transferred from the courthouse to the hospital of Tora prison, near Cairo, state television reported that the former president suffered a "health crisis".
The BBC's Jon Leyne says that Mubarak has had regular health lapses in the past.
Since his trial began last August, he has been held in the International Medical Centre outside the capital, as his lawyer said he was in poor health.
Tora prison is where a number of figures from the former government are serving jail sentences for corruption and reports say Mubarak has now been admitted to the hospital there.
His sons, Alaa and Gamal, are to remain in detention despite their acquittal because they are to go on trial on charges of stock market manipulation.
'Years of darkness'
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.
The ruling comes as political tensions are rising in Egypt between the two rounds of voting in a presidential election.
Correspondents say many of Egypt's 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 Muslim Brotherhood – the main opposition force under Mubarak's rule – condemned the verdict and urged a meeting between key political forces to discuss the trial's outcome.
A spokesman called for a retrial and said the prosecutor failed to "carry out its full duty in gathering adequate evidence to convict the accused".
But Mr Shafiq said that the verdicts "must be accepted", adding that the rulings would serve as a lesson for future presidents.
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.
BBC