CAIRO – Egypt’s prime minister ordered Wednesday that deposed autocrat Hosni Mubarak be placed under house arrest after he’s released from prison following more than two years in detention.

The announcement came hours after a court ordered Mubarak be released for the first time since he was first detained in April 2011, a move threatening to further stoke tension in a deeply divided Egypt. Many feared Mubarak’s release would amplify Islamist allegations that last month’s military coup was a step toward restoring the old regime.

Prime Minister Hazem el-Beblawi said in a statement that he ordered Mubarak be put under house arrest as part of the emergency measures put in place this month.

The decision appeared designed to ease some of the criticism over Mubarak being freed from prison and ensure he appears in court next week for a separate trial.

Prison officials said Mubarak may be released as early as Thursday. It is not clear where Mubarak will be held under house arrest, whether in one of his residences or in a hospital considering his frail health. Since his ouster, 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.

His wife, Suzanne, has been living in Cairo and keeping a low-profile, occasionally visiting Mubarak and their two sons in prison. But security officials said Mubarak was more likely to be moved to a military hospital because of his ailing health.

The order for Mubarak’s release followed an appeal by his lawyers in one of his corruption cases. He is also on trial on charges of complicity in the killing of protesters in the 2011 uprising against him that could put him back behind bars. He also faces investigation into at least two other corruption cases.