Egypt’s deposed autocrat Hosni Mubarak is expected to be freed from prison and placed under house arrest on Thursday after being ordered released the previous day, following more than two years in detention.

The development is a new twist in the saga of the long-time President, toppled in Egypt’s popular uprising in 2011, and could potentially stoke tensions in the deeply divided nation. It could also amplify the anger against the military-backed government and Islamist allegations that last month’s military coup against Mr. Mubarak’s successor, Mohamed Morsy, was a step toward restoring the old regime.

On Wednesday, Prime Minister Hazem el-Beblawi ordered Mr. Mubarak be put under house arrest as part of the emergency measures imposed this month after Mr. Morsy’s removal from office. The decision appeared designed to ease some of the criticism over Mr. Mubarak being freed from prison and ensure that he appears in court next week for a separate trial.

Mr. El-Beblawi’s announcement came hours after a court ordered Mr. Mubarak be released for the first time since he was first detained in April 2011.

Prison officials said he may be released as early as Thursday but it was unclear where he will be held under house arrest, whether in one of his residences or in a hospital, considering his frail health.

Since his ouster, Mr. Mubarak’s supporters have released conflicting details about his health, including that the 85-year-old suffered a stroke, a heart attack and at times went into a coma. His critics called these an attempt to gain public sympathy and court leniency.

The order for Mr. Mubarak’s release followed an appeal by his lawyers in one of his corruption cases.

The prospect of Mr. Mubarak being freed, even if only temporarily, would feed into the larger crisis bedeviling Egypt- the violent fallout from the July 3 coup that unseated Mr. Morsy, an Islamist who became Egypt’s first freely elected president following Mr. Mubarak’s ouster.

Mr. El-Beblawi’s decision followed an appeal from the youth campaign that spearheaded the petition and protests against Mr. Morsy, asking the interim authorities to use the emergency measures in place earlier this month to keep the former president behind bars.

The group Tamarod blamed Mr. Morsy’s government for Mr. Mubarak’s coming release because they said it failed to admit new evidence in the case against the autocrat.

In a statement, Mr. Tamarod warned against releasing Mr. Mubarak, saying it would be a threat to national security.

“If it is acquittal for Mubarak today, it will be acquittal for Morsy tomorrow,” the group said, vowing to hold a public show trial for Mr. Mubarak. “We will not remain silent about freedom for any killer of the Egyptian people,” the group added.

Since his July 3 ouster, Mr. Morsy has been held incommunicado at an undisclosed location. Several top leaders and other figures of the Muslim Brotherhood, the Islamist group from which Mr. Morsy hails, have been arrested and charged.

The three judges who ordered Mr. Mubarak be freed met in Tora prison, where he has been held for most of his detention since April 2011. But even before they ruled, human rights advocates have argued for a new system of justice to make up for a shoddy prosecution and a judiciary divided between loyalists of the old regime, Islamists and independents.

Egypt’s prosecutor Hesham Barakat told local media that the Wednesday decision was final and his office has no plans to appeal it. A senior prison official, Mostafa Baz, told the private CBC television station that his office will ask the prosecutors on Thursday whether Mr. Mubarak is wanted in other cases. If he’s not, Mr. Baz said the former leader would be freed.

The possibility of Mr. Mubarak’s release came in the midst of the post-coup crackdown that has left more than 1,000 people dead and hundreds in detention. Despite the crackdown, the pro-Morsy groups vowed to hold massive rallies on Friday.

Since his overthrow in February 2011, Mr. Mubarak has been on a roller coaster ride through the courts during which he has been convicted, only for another court to overturn the ruling, grant him a retrial and order him released. Still, he was kept behind bars pending his retrial and on other charges.

For his first trial, on charges of corruption and conspiracy in the deadly shooting of nearly 900 protesters during the uprising against him, he was on a gurney behind prison cage bars and denied the charges. The first Arab leader to face trial by his own people, Mr. Mubarak was convicted and sentenced to life in prison.

In January, a court overturned his life sentence on the grounds that the prosecution lacked concrete evidence and failed to prove the protesters were killed by the police. His trial on charges of alleged complicity in the killing of protesters resumes August 25.

More In: World | International | News