CAIRO – Egypt’s ousted president Hosni Mubarak was ordered to be freed from detention on Monday, according to the prosecutor who signed his release order – ending nearly six years of legal proceedings against the long-ruling autocrat.

The prosecutor, Ibrahim Saleh, told The Associated Press that he ordered Mubarak’s release after he accepted a petition by the former president’s lawyer for his freedom on the basis of time already served.

Mubarak, 88, was acquitted by the country’s top appeals court on March 2 of charges that he ordered the killing of protesters during the 2011 revolution. That verdict, according to Saleh, cleared the way for Mubarak’s lawyer to request his release.

Mubarak, according to Saleh, has already served a three-year sentence for embezzling state funds while in detention in connection with the protesters’ case.

A criminal court ruled in May 2015 to jail Mubarak for three years and fine him millions of Egyptian pounds following his conviction for embezzling funds earmarked for the maintenance and renovation of presidential palaces. The ruling was upheld by another court in January 2016.

Story continues below advertisement

READ MORE: Egypt’s Mubarak to be retried over killing of protesters

“There is not a single reason to keep him in detention and the police must execute the order,” Saleh said. “He is free to go.”

News of Mubarak’s imminent release was greeted jubilantly by his supporters on a Facebook page entitled “I am sorry, Mr. President.”

One supporter, Tamer Abdel-Moneim, described Mubarak’s trial in a column in the popular Al-Youm al-Sabei news site as a “farce.” He wrote: “The oppression and injustice that befell the man compels upstanding men to rally behind him to stop the silliest and most contemptuous farce we have recently known.”

The order to release Mubarak was the latest in a series of court rulings in recent years that acquitted some two dozen, Mubarak-era cabinet ministers, top police officers and aides charged with graft or in connection with the killing of some 900 protesters during the uprising. Some of them have made a comeback to public life, while others partially paid back fortunes they illegally amassed.

Activists, meanwhile, say Mubarak’s acquittal of killing protesters has confirmed long-held suspicions that his trial and that of scores of policemen who faced trial on the same charge would never bring the justice they demanded.

It has also, according to activists and Egypt’s beleaguered rights campaigners, confirmed widely-held suspicions that their “revolution” has been reversed by the government of President Abdel-Fattah el-Sissi, a general-turned-politician, in order to restore the status quo in a country ruled undemocratically by men of military background for most of the past 60-plus years.

Story continues below advertisement

“I knew from the very beginning that this was not going to take us anywhere,” said rights lawyer Amir Salem, who represented the fallen protesters’ families in the Mubarak trial. “The trial of Mubarak needed an independent judiciary, which we don’t have. But one day, he will be truly tried, but not under el-Sissi.”

Powerful media figures loyal to el-Sissi have relentlessly vilified the 2011 uprising as a conspiracy and demonized its icons as foreign agents who pose a threat to the country’s national security. The fallen protesters, contend some of them, were shot by members of the now-banned Islamist group, the Muslim Brotherhood.

The attacks began soon after el-Sissi, as defence minister, led the 2013 ouster of the Brotherhood’s Mohammed Morsi, Egypt’s first freely elected leader whose one-year in office proved divisive.

Mubarak was first detained in April 2011, but has spent the nearly six years since in hospitals. He is currently staying at a Nile-side military hospital in the leafy suburb of Maadi, just south of Cairo.

His lawyer, Farid el-Deeb, told the AP on Monday that he expected Mubarak to return home within a day or two. When he does, he will join Suzanne, his wife of nearly 60 years, his two sons – one-time heir apparent Gamal and wealthy businessman Alaa – their wives and three grandchildren.

Mubarak’s sons were also convicted and sentenced to three years in prison in the same embezzlement case. They still face charges in an insider trading case, but both are free and have recently made a series of intensely publicized appearances greeted enthusiastically by hardcore supporters of their father.

Story continues below advertisement

Earlier on Monday, el-Sissi pardoned more than 200 people convicted and jailed for their participation in illegal protests. The pardon of the 203 prisoners did not cover any of the iconic, secular activists jailed for violating the 2013 protests law, which has effectively ended street activism in Egypt except for demonstrations by government supporters.

El-Sissi has overseen a major crackdown primarily targeting Islamists along with secular pro-democracy activists since Morsi’s ouster. He took office a year later with a landslide victory in presidential elections.

Along with jailing critics, el-Sissi’s government has steadily eroded freedoms won in the 2011 uprising.