Former Egyptian President Hosni Mubarak has been released from prison after appealing against his detention.
He was taken by helicopter from Cairo’s Tora prison to a hospital and is later expected to be put under house arrest.
Mr 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 military-backed interim government’s crackdown on Islamists opposed to the army’s ousting of Islamist President Mohammed Morsi on 3 July.
Hundreds of members of the Muslim Brotherhood, to which Mr Morsi belongs, have been detained, including its most senior leader Mohammed Badie, who was wanted over alleged incitement to violence and murder.
Tensions remain high across Egypt, and the US embassy has warned American nationals in Cairo to stay in their homes or nearby from 13:00 local time (10:00 GMT) on Friday – in anticipation of fresh street protests after traditional prayers, according to the Associated Press.
On Thursday, the medical helicopter arrived at Tora, as dozens of Mubarak supporters – some waving flags – gathered outside the prison.
Egyptian TV then showed the helicopter transferring Mr 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 verdict 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 Mr Mubarak’s release – a move intended to keep the ailing ex-leader in detention.
But shortly after the court ruling, the office of Prime Minister Hazem el-Beblawi said Mr 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.
“He protected the country,” Lobna Mohamed, a housewife in the crowd of Mubarak supporters outside the prison was quoted as saying by Reuters.
“He is a good man, but we want (Abdul Fattah) Sisi now,” she said, referring to the head of the armed forces, who overthrew Mr Morsi.
But many Mubarak opponents were dismayed by his release.
“It’s the return of the figure that Egyptian people revolted against,” Muslim Brotherhood member Mona al-Qazzaz told the BBC.
Mr 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 Mr 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 licences on military equipment to Egypt and to reassess security co-operation in response to the clampdown.
Arms are provided by individual countries rather than the EU as a whole, mostly by Germany, France and Spain. The UK has already suspended some of its military help.
But the 28-member bloc’s humanitarian aid to Egypt remains unaffected, despite calls from some EU politicians to cut the assistance after more than 900 people were killed in clashes last week.
The violence erupted as security forces cleared two sit-ins in Cairo by people demanding the reinstatement of Mr Morsi.