A Brazilian oil and mining magnate, who was once one of the richest men in the world, has left a notorious prison in Rio de Janeiro for house arrest ahead of a corruption trial.
Eike Batista had an estimated worth of more than $35bn (£27bn) five years ago, but lost most of it as his empire collapsed.
He is accused of bribery and hiding illegal funds offshore, but denies any wrongdoing.
He was arrested in January.
Mr Batista's lawyers argued that he had been put in prison merely to placate public opinion.
High court judge Gilmar Mendes ruled that Mr Batista could await his trial under house arrest because none of the alleged crimes involved violence or threats to others.
Who is Eike Batista?
- Seen by many as the face of Brazilian capitalism
- Bold, extravagant and charismatic, he made most of his fortune during the commodities boom that brought great wealth to Brazil
- Listed in 2012 by Forbes Magazine as the world's seventh-richest man, with an estimated fortune of $35bn
- His Grupo EBX conglomerate spanned mining, oil, shipbuilding and logistics
- After EBX collapsed following a crash in demand for commodities, his wealth slumped to under $1bn
Under Brazilian law, Mr Batista would have been sent to a special prison wing if he had held a university degree.
But as he dropped out before finishing his engineering degree in Germany, he was serving time in an ordinary cell with six other inmates at the Bangu penitentiary.
Many Brazilian jails are overcrowded and controlled by criminal gangs. The authorities in Rio say, however, that is not the case at Bangu.
Under the terms of his release, Mr Batista must remain at his home in Rio de Janeiro and can be visited by the police at any moment without warning.
He is also not allowed to act as a director of his remaining companies.
He will stand trial alongside the ex-governor of Rio de Janeiro, Sergio Cabral, who allegedly took $16.5m in bribes from Mr Batista.
The former billionaire is also facing accusations in the United States, where investors argue that he knew that oil exploration contracts won by one of his companies were worthless.
They also allege that he lied about new oil discoveries worth trillions of dollars.
Mr Batista denies the charges, and has said he will help the authorities in their efforts to tackle corruption - which he says is widespread in Brazil.