However, he will remain in custody pending investigation into fraud chargess, state media reported.
The Cairo Court of Appeal ordered Mubarak's release after the expiry of the maximum temporary detention of two years, the reports said. He had been granted a retrial in the murder case, appealing against a life sentence.
Mubarak, who ruled Egypt for three decades, was ousted in a popular uprising in 2011.
He has been under arrest since April 2011 charged with complicity in the murder and attempted murder of hundreds of peaceful protesters on January 25 to 31 2011. He is also facing several charges of corruption.
Defence lawyer Farid al-Dib made the case for his release on the grounds that Mubarak has spent two years in custody.
Court appearance
There were questions over whether Mubarak would appear in court on Saturday for his scheduled retrial along with his top security chiefs for their alleged complicity in the murder and attempted murder of hundreds of peaceful protesters in January 2011.
But on Saturday, Mubarak was in the dock, sitting upright and looking strong. Wearing sunglasses, he waved and smiled at supporters, chatting casually with his two sons Alaa and Gamal who face corruption charges.
The retrial came to an abrupt end with the main judge stepping aside and sending the case to the court of appeal, which will then refer it to a new circuit.
In January, Egypt's highest court, the court of cassation, ordered a retrial for Mubarak after accepting an appeal against his life sentence, citing procedural failings.
Morsi
Former interior minister Habib al-Adly had also been sentenced to life for his involvement in the deaths of the protesters, but controversially his security chiefs were acquitted, sparking widespread anger and protests after the verdict in June.
President Mohamed Morsi, who won elections last June on the Muslim Brotherhood's ticket, had pledged new trials for former regime officials, including Mubarak, implicated in the protesters' deaths.
But Morsi's presidency has been plagued by unrest and deadly clashes between protesters and police, a revolt in the canal cities, sectarian violence and a devastating economic crisis, in what many fear is taking Egypt to the brink. – AFP