(Corrects 8th paragraph to say Mubarak is in a military hospital, not prison hospital)
* Four ex-ministers also granted retrials in graft cases
* Zakaria Azmi still faces travel restrictions
* Activists say trials have failed to achieve real justice
CAIRO, Feb 13 (Reuters) - A Cairo court on Wednesday ordered the release from prison of one of deposed Egyptian President Hosni Mubarak's closest aides after he was granted a retrial in a corruption case.
Four other high-ranking officials from Mubarak's government, including a former prime minister, were also given retrials in their graft cases, according to state media.
Many former officials have been convicted on graft and other charges since Mubarak fell to a popular uprising in February 2011, but activists say the long, complicated legal proceedings have failed to produce real justice.
Zakaria Azmi, Mubarak's former chief of staff, was sentenced last May to seven years in jail and fined 36.4 million Egyptian pounds ($6 million) on charges of making illegal gains.
An appeals court recently ordered a retrial in that case, and a separate criminal court ruled on Wednesday that Azmi must be released under a law that says a suspect can not be held in prison for more than 18 months.
Azmi has been in detention for about 22 months, state news agency MENA reported.
The former top aide, one of the most senior members of Mubarak's inner circle, will still face travel and financial restrictions but not be confined to his home.
Mubarak is in a military hospital. Last month a Cairo court granted him a retrial after he was jailed for life over the killing of protesters by security forces trying to quell the uprising against him.
Also on Wednesday, an appeals court annulled the verdicts of former prime minister Ahmed Nazif, former interior minister Habib al-Adli and former finance minister Youssef Boutrous-Ghali in a separate graft case, MENA said.
Boutros-Ghali fled abroad before his trial, while the other two have been in prison.
The three had been convicted of squandering 92 million Egyptian pounds in public funds in a case involving irregularities in the procurement of vehicle licence plates.
Former tourism minister Zoheir Garrana was also granted a retrial in a case in which he is accused of illegally issuing licences to tourism companies, MENA said.
All four former officials also face separate graft cases, while Adli is further charged with involvement in the killing of protesters. (Reporting by Alexander Dziadosz; Editing by Paul Taylor and Mark Heinrich)