An Egyptian judge convicted former president Hosni Mubarak of complicity in the killings of protesters during the uprising that ended his 30-year rule and sentenced him on Saturday to life in prison.
It was the first time a deposed Arab leader had faced an ordinary court in person since a wave of uprisings shook the Arab world last year, sweeping away four entrenched rulers.
The ruling came at a politically fraught time for Egypt, two weeks before a run-off in its first free presidential election that will pit the Muslim Brotherhood, which was banned under Mubarak, against the deposed autocrat's last prime minister.
Mubarak, propped up on a hospital stretcher and wearing dark sunglasses, heard the verdict with a stony expression. He had been wheeled into the cage used in Egyptian courtrooms, while the other defendants stood.
Demonstrators outside the court, many of whom had been demanding the death penalty for Mubarak, greeted the verdict with fireworks and cries of "Allahu akbar (God is great)".
Soha Saeed, the wife of one of about 850 people killed in the street revolt that toppled Mubarak on February 11, 2011, shouted: "I'm so happy. I'm so happy." Some people inside the court who had wanted a death sentence scuffled with guards, decrying the Mubarak-era judiciary. "The people want the judiciary cleansed!" they chanted. One man held up a sign calling for Mubarak to be executed, others chanted for a death sentence.
Judge Ahmed Refaat opened the proceedings by calling the start of Mubarak's trial on August 3 a "historic day". He hailed Egyptians for removing the only leader many of them had known. "The people of Egypt woke on Tuesday, Jan. 25, to a new dawn, hoping that they would be able to breathe fresh air ... after 30 years of deep, deep, deep darkness," he told the court.
Total silence fell over the courtroom in the moments before Refaat announced his verdict.
The crowd outside then erupted in joy. Anti-Mubarak demonstrators and a smaller crowd of his supporters threw stones at each other and at police.
The judge also sentenced Mubarak's former interior minister, Habib al-Adli, to life in prison.
He sentenced Mubarak's two sons Alaa and Gamal to time already served after convicting them on some corruption charges and acquitting them on others.
Six security officials were acquitted.
Verdict on the "pharaoh"
Many Egyptians are angry that the hated police force, blamed for many of the deaths in the uprising, and other pillars of Mubarak's rule have survived his downfall intact.
A helicopter had flown Mubarak to the court on the outskirts of Cairo from the military-run hospital where he has been held in custody. Egyptian state television said the prosecutor-general had ordered that Mubarak be transferred to prison from hospital to serve his sentence. No details were immediately given. His co-defendants have been held for months in a Cairo prison.
Hundreds of police with riot shields and batons surrounded the police academy where the 10-month trial has been held. "Enough talk, we want execution!" protesters chanted outside before the verdict. Few Egyptians had expected Mubarak would go to the gallows, although protesters have often hung his effigy from lamp posts.
"I want nothing less than the death penalty for Mubarak. Anything less and we will not be silent and the revolution will break out again," Hanafi el-Sayed, whose 27-year-old son was killed early in the uprising, said just before the verdict. He had travelled from Alexandria for the trial.
In a June 16 and 17 run-off, Ahmed Shafiq, an ex-air force chief like Mubarak, will face the Brotherhood's Mohamed Mursi. Shafiq has called his former boss a role model. His Islamist rival says that if he becomes president he will ensure enough evidence is produced to keep Mubarak behind bars for life. "It is not possible to release Mubarak," Mursi told Reuters on Thursday.
"I promise the martyrs (of the uprising) will retrieve their rights in full, God willing."
(Additional reporting by Yasmine, Saleh, Tom Perry and Marwa Awad; Writing by Edmund Blair)