Hosni Mubarak has been released from Cairo prison after appealing against his detention.
The former Egyptian president was flown out of Tora prison by helicopter to a hospital, but is now expected to be put under house arrest.
Hosni Mubarak, 85, still faces charges of corruption and complicity in the killing of demonstrators during the protests that toppled him in 2011.
His release is seen by many as a sign that the military is rolling back the changes that flowed from the uprising.
Egypt is currently under a state of emergency amid the bloodshed which has accompanied the army-backed interim government’s crackdown on Islamists opposed to the army’s ousting of Islamist President Mohamed Morsi on 3 July.
Hundreds of members of the Muslim Brotherhood – the movement from which Mohamed Morsi comes – have been detained, including its most senior leader Mohammed Badie, who was wanted over alleged incitement to violence and murder.
On Thursday, the medical helicopter arrived at Tora, as dozens of Hosni Mubarak supporters – some waving flags – gathered outside the prison.
Egypt’s TV channel then showed the helicopter transferring Hosni Mubarak to a military hospital in the capital. The ex-leader was seen being transferred from the aircraft into an ambulance outside the hospital, amid heavy security.
This comes after a court ruled on Wednesday that the former leader must be released in a corruption case.
The ruling came during the hearing on charges that the former president had accepted gifts from state-run publisher al-Ahram. The value of the gifts has since been repaid.
The court said its decision was final and no appeal would be allowed.
Prosecutors have previously brought new charges when courts have ordered Hosni Mubarak’s release – a move intended to keep the ailing ex-leader in detention.
But shortly after the court ruling, the office of PM Hazem el-Beblawi said Hosni Mubarak would be placed under house arrest after his release.
“In the context of the emergency law, the deputy military commander issued an order that Hosni Mubarak should be put under house arrest,” the office said in a statement.
Hosni Mubarak was sentenced to life in jail last year for complicity in the killing of demonstrators, but a retrial was later ordered after his appeal was upheld.
That retrial opened in May but Hosni Mubarak has now served the maximum amount of pre-trial detention permitted in the case.
European Union foreign ministers on Wednesday agreed to stop export licenses on military equipment to Egypt and to reassess security co-operation in response to the clampdown.