Hosni Mubarak has appeared frail in some of his court appearances
Former Egyptian President Hosni Mubarak is to be put under house arrest following a court order to release him in a corruption case, officials say.
The prime minister's office said the measure would be taken "in the context of the emergency law" currently in place across the country.
Mr Mubarak, 85, is expected to be released from prison later on Thursday.
He still faces charges of complicity in the killing of protesters during the uprising that ousted him in 2011.
He was sentenced to life in jail last year, 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.
The office of Prime Minister Hazem el-Beblawi made its announcement late on Wednesday.
"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.
Egypt is under a state of emergency amid the bloodshed which has accompanied the 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 - the movement from which Mr Morsi comes - have been detained including its most senior leader Mohammed Badie, who was wanted over alleged incitement to violence and murder,
The prime minister's statement came shortly after the court in Cairo to release Mr Mubarak.
Asked when the former leader could actually leave the prison, his defence lawyer Fareed El-Deeb told Reuters: "Maybe tomorrow (Thursday)."
The ruling came during a hearing on charges that the former president had accepted gifts from state-run publisher al-Ahram.
State prosecutor Ahmed el-Bahrawi was quoted by Reuters as saying that the ruling "is final and the prosecution cannot appeal against it".
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.
Analysts say Mr Mubarak's release - if it happens - would be seen by many as a symbolic sign the military is rolling back the changes that flowed from the 2011 uprising.
European Union foreign ministers on Wednesday held urgent talks to determine a response to the clampdown.
At the meeting in Brussels, they agreed to stop export licences on military equipment to Egypt and to reassess security co-operation.
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.
"Europe is speaking with a loud and clear voice," Swedish Foreign Minister Carl Bildt told the BBC's World Tonight programme, speaking about the latest measures taken by the EU.
"We condemn in the clearest possible terms the violence we've seen with the government wave of repression and clampdown and killing, but also the killing of policemen and attacks against Coptic churches," he added.
But the 28-member block's humanitarian aid to Egypt would remain 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.
The EU's foreign policy chief, Baroness Catherine Ashton, said: "Assistance to the most needy will remain. All member states feel very strongly they want to continue to support the people of Egypt."
She earlier offered to mediate a political solution to the crisis and is working on "confidence building measures" between the interim government and Brotherhood.
In Washington, senior officials discussed on Tuesday whether to reduce the $1.3bn (£830m) in military aid that the US gives Egypt every year. The meeting reportedly produced no imminent changes to US policy.