CAIRO — Five of six security chiefs tried with ousted president Hosni Mubarak over the deaths of protesters were to be released on Sunday, as Egypt’s state prosecutor prepares to appeal the sentences.

Thousands of people protested in Cairo for a second day after Saturday’s verdicts handed Mubarak and his interior minister Habib Al Adly life in prison over the deaths of protesters but acquitted the police commanders.

The acquittals sparked nationwide outrage and criticism from international rights groups which said the verdict could provide impunity for police violence.

Five security chiefs are set to be freed, but the head of the now-dissolved state security apparatus, Hassan Abdel Rahman, will remain in prison pending investigation into another case in which he is accused of destroying state security documents.

A travel ban imposed on the six in February 2011 will remain in place, the state prosecutor said.

Thousands of people were in Cairo’s iconic Tahrir Square late Sunday, joining hundreds who spent the night there after a day of protest.

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. He was also cleared of graft charges.

He and the security commanders were charged with complicity in the killings of some of the roughly 850 protesters killed during the uprising that overthrew him in February 2011.

On Sunday, the ex-dictator was issued regulation blue prison uniform and guards at the Cairo Tora prison took his official mugshot and gave him his prisoner number, state news agency MENA reported.

A tearful Mubarak, who enjoyed near absolute power for three decades, was flown by helicopter to the prison on Cairo’s outskirts after the verdict but then refused to leave the aircraft.

Along with acquitted police chiefs, Mubarak’s sons Alaa and Gamal had corruption charges against them dropped on a technicality, prompting protests in Cairo, Alexandria and other cities.

The state prosecutor’s office said he had ordered “the start of the appeals procedure” against sentences in the trial, but did not clarify whether all of the verdicts or just the acquittals would be appealed.

Mubarak’s defence has also said it would appeal.

Both the toppled dictator’s defence team and lawyers representing his victims said the life sentence verdict could easily be appealed, triggering fears among protesters that Mubarak could eventually walk free.

Around 20,000 people thronged Tahrir Square on Saturday after the verdicts. Some slept overnight in tents or in the open at the vast intersection, epicentre of the 18-day revolt that forced Mubarak to resign.

“Many people had the feeling while listening to the verdict that we were back in the days of the old regime,” said one protester, student Feda Essam.

Demonstrators erected a memorial depicting a miniature cemetery in tribute to the “martyrs” of the revolution.

“Martyrs, we will not abandon you to the conspiracies of the old regime. In the name of your blood, there will be a new revolution,” read a banner.

On Saturday after the verdicts, Muslim Brotherhood 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 before joining the crowds in Tahrir Square for around 15 minutes.

Saturday’s verdict came just two weeks before a presidential election run-off that will pit Mubarak-era premier Ahmed Shafiq against Mursi in a highly polarised race.

On Sunday, Shafiq tried to establish his democratic credentials and said his Brotherhood rival would bring back the “dark ages”.

The ex-air force commander said that under his leadership Egypt would respect human rights.

“No one will be detained for their opinion... Security services will be committed to the law and to human rights standards,” he told a news conference.

“I represent a secular state... the Brotherhood represents a sectarian state.”

Leftist politician Hamdeen Sabbahi and moderate Islamist politician Abdel Moneim Abulfotouh, who came third and fourth respectively in the first round of elections, met on Sunday to try to consolidate their positions ahead of the run-off, sources told AFP.

Rights groups slammed Saturday’s 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.”