Egypt's high court on Tuesday overturned the only remaining conviction against former president Hosni Mubarak, opening the way for his possible release four years after the revolution that toppled him.

Mubarak, 86, was sentenced to three years in prison last May for diverting public funds earmarked to renovate presidential palaces and using the money to upgrade family properties. His two sons were given four-year jail terms in the same case.

Suffering from ill health, he has been serving his sentence in a military hospital in the upscale Maadi district of Cairo.

Mubarak remains detained for now, but judicial sources say he could soon walk free as no convictions remain against him after the high court ordered a retrial in the embezzlement case.

His release, while thousands of his political opponents languish in jail, would be a further blow to activists who had hoped his downfall in the 2011 Arab Spring marked the dawn of a new era of political freedom in Egypt.

Tuesday's verdict follows a court decision in November to drop charges against Mubarak of conspiring to kill protesters in the uprising that ended his 30-year rule.

That ruling led to protests in which at least two people were killed.

"After the release of police officers charged with killing demonstrators and of Mubarak aides, and his acquittal over the killing of protesters, this is not shocking news," said Khaled Dawoud, spokesman for the opposition Dostour Party, 10 of whose members are behind bars for taking part in peaceful protests.

"But I don't think Mubarak is the issue any more. The Egyptian people gave their verdict against him four years ago."

Crackdown on Islamists

Many Egyptians who lived through Mubarak's rule view it as a period of autocracy and crony capitalism.

His overthrow led to Egypt's first free election. But the Islamist victor, Mohamed Mursi, was ousted in 2013 by then-army chief Abdel Fattah al-Sisi, following protests against his rule.

Sisi, who went on to win a presidential election last May, launched a crackdown on Mursi and his Muslim Brotherhood. Security forces have rounded up thousands of Brotherhood supporters and courts have sentenced hundreds to death in mass trials that have drawn international criticism.

Liberal activists have also found themselves on the wrong side of Egypt's new rulers, facing jail for breaking a law that curtails the freedom to protest.

By contrast, Mubarak-era figures are slowly being cleared of charges and a series of laws curbing political freedoms have raised fears among activists that the rights won during 18 days of protest in Cairo's Tahrir Square, the symbolic heart of the revolution, are being eroded.

The Court of Cassation, which ordered the retrial, did not say if Mubarak should be freed on bail in the meantime.

Mubarak also faces retrial for a third and final time over charges of involvement in the death of demonstrators in 2011.

The official MENA news agency quoted an interior ministry source as saying Mubarak and his sons would only be released on orders from the public prosecution or the court that retries them.

A source in the public prosecutor's office said it was up to the courts that retry Mubarak whether to release him on bail or to keep him in pretrial detention pending a verdict, suggesting he will remain incarcerated for the time being.

But his lawyer, Fareed el-Deeb, told reporters after Tuesday's hearing that Mubarak had served the maximum permitted time in pretrial detention and should be freed.

Before his conviction in the presidential palaces embezzlement cases in May, Mubarak had been freed on that basis.