Egypt's prosecutor-general ordered on Monday the release of ousted President Hosni Mubarak following his acquittal earlier this month on charges of killing protesters during the 25 January Revolution.
The petition said Mubarak's three-year sentence for embezzling state funds has been served while in detention for the protesters' case, the Associated Press reported.
Egyptian army chief General Abdel Fattah al-Sisi, later went on to win a presidential election in 2014.
The ruling is final as it was Mubarak's second retrial, which can not be appealed, after he was sentenced to life imprisonment in 2012, and then acquitted of the same charges two years later. Both his sons have also been also freed.
Mubarak was arrested in April 2011 but has spent the almost six years since in hospitals.
Hosni Mubarak, who was overthrown as president of Egypt in an uprising in 2011, will be released from detention in a military hospital, his lawyers and judicial sources said.
Mubarak is still banned from travel pending investigations by the Illicit Gains Authority into an increase in his personal wealth since the 2011 revolution, according to his lawyer Farid El-Deeb. It was not immediately clear when he would leave for his home in the eastern suburb of Heliopolis.
Amid public anger, prosecutors had levelled various charges against Mubarak following his February 2011 resignation.
Six years after his overthrow, most of the charges brought against his regime members have been dismissed while the country still recovers from the aftermath of the uprising.