CAIRO - An Egyptian court ordered Thursday the release of the two sons of ousted president Hosni Mubarak pending a corruption retrial, a judicial official said.

Their lawyer Farid al-Deeb told AFP that Alaa and Gamal Mubarak were free to leave prison after the court order because they had served the maximum pretrial detention period.

An appeals court earlier this month ordered their retrial, along with their father, overturning a lower court conviction that saw the two given four-year jail sentences.

Deeb had said Mubarak himself, who is in a military hospital, would also be a free man, but state media reported that there had been no orders yet for his release.

A court in November also dropped murder charges against Mubarak over the deaths of some of the roughly 800 protesters killed during the 18-day uprising that unseated him in early 2011.

The release of the Mubaraks presents a dilemma for President Abdel Fattah al-Sisi, a former army chief whom opponents accuse of reviving Mubarak-era practices.

Sisi massively won an election last year after overthrowing the divisive Islamist president Mohamed Morsi in 2013.

Morsi, a leader of the Islamist opposition under Mubarak, is himself now on trial over violence during the 2011 uprising in which protesters torched police stations across the country.