Thousands of angry protesters across Egypt took to the streets on Saturday after ex-president Hosni Mubarak and his security chief were given life in prison over the deaths of protesters in 2011 but six police chiefs were acquitted.
Mubarak, the only autocrat toppled in the Arab Spring to be put in the dock, could have been sent to the gallows as demanded by the prosecution.
Both the toppled dictator's defence team and lawyers representing his victims said the verdict could easily be appealed.
The verdict prompted outrage inside and outside the courtroom, with protesters staging rallies in Cairo, Alexandria and other Egyptian cities.
"Either we get justice for our martyrs or we die like them!" chanted those gathered in Cairo's Tahrir Square.
The Muslim Brotherhood's presidential candidate Mohammed Mursi said the revolution must continue.
"All of us, my brothers, must realise in this period that the continuation of the revolution, and the revolutionaries' staying put in their positions in the squares, is the only guarantee to achieve the goals," he told reporters.
Judge Ahmed Refaat sentenced Mubarak, 84, and his interior minister Habib al-Adly to life for their role in the deaths of more than 800 protesters during the revolt that ousted them, but acquitted the six security commanders on the same charges.
A senior member of Mubarak's defence team told AFP the former strongman will appeal.
A tearful Mubarak, who enjoyed near absolute power for three decades, was flown to Tora prison on Cairo's outskirts after the verdict but then refused to leave the aircraft.
A security official said Mubarak "suffered from a surprise health crisis" but was finally convinced to return to his cell.
Chants of "Void, void" and "The people want the judiciary purged" erupted after the sentencing, as furious lawyers told AFP they feared Mubarak would be found innocent on appeal.
The powerful Muslim Brotherhood told AFP it had called for mass protests nationwide, while other groups including the pro-democracy April 6 movement announced they would also hold demonstrations.
Thousands marched on Tahrir Square, epicentre of the protests that toppled Mubarak, chanting against the judiciary and the military council that took power when he quit.
There were similar rallies in the Mediterranean city of Alexandria and other parts of Egypt, where many were in shock at the police chiefs' acquittal.
Rights groups also slammed the verdict.
Mubarak's sentence "is a significant step towards combatting long-standing impunity in Egypt" but the security chiefs' acquittal "leaves many still waiting for full justice," Amnesty International said.
"Many see the acquittal of all the senior security officials as a sign that those responsible for human rights violations can still escape justice."
Human Rights Watch Cairo-based researcher Heba Morayef told AFP "the verdict fails to deliver justice, it fails to deter police from future abuse and it comes against the backdrop of acquittals in police trials."
Corruption charges against Mubarak's sons, Alaa and Gamal, were dropped because of the expiry of a statute of limitations, and the ex-president was acquitted in one of the graft cases.
But Alaa and Gamal will stay in prison because they are on trial in another case.
"We will appeal. The ruling is full of legal flaws from every angle," Yasser Bahr, a senior member of Mubarak's defence team, told AFP.
"We will win, one million percent," he added.
Mubarak, in dark sunglasses and wearing a beige track-suit, had his arms folded and showed no emotion inside the caged dock as Refaat read the verdict.
His sons, however, appeared close to tears.
"It's vindicating to Egyptians to see Mubarak and his interior minister sentenced to life, but the verdict raises more questions than answers," said Hossam Bahgat, the director of the Egyptian Initiative for Personal Rights.
"The court appears to have found no evidence that the killings were committed by policemen. It seems the court convicted Mubarak and Adly for failing to prevent the killings," Bahgat told AFP.
"It's 100 percent certain that this will go to appeal and the court is very likely to order a retrial."
In delivering the ruling, Refaat painted a grim picture of life under Mubarak, listing hardship after hardship during his three-decade rule.
Refaat said the protesters who joined the uprising were "peaceful" and wanted only "justice, freedom and democracy."
Clashes erupted outside the courtroom after the sentencing, with police using stun grenades against angry crowds.
Mubarak, Adly and the six others had faced charges over their involvement in ordering the deaths of some of the estimated 850 people killed in the uprising.
Egypt has been ruled by the military since Mubarak was forced out on February 11 last year after 18 days of nationwide protest.
Mubarak was held at a hospital in the Red Sea resort of Sharm el-Sheikh following his arrest, before the military appeared to bow to protester demands that he and ex-regime officials face trial.
The trial began on August 3 last year, and Mubarak has been held in Cairo ever since.
The military insists that the prosecution case and charges were independent judicial decisions, but critics say the investigation was hasty and sloppy, resulting in a trial based on patchy evidence that may see Mubarak acquitted.
Saturday's verdict comes just two weeks before a presidential election run-off that will pit Mubarak's former premier Ahmed Shafiq against the Brotherhood's Mursi in a highly polarised race.
It is the first openly contested presidential election in any of the Arab countries swept by protests and uprisings challenging decades of autocratic rule.