Pat Hickey is going to have pay over €400,000 to leave Rio.
The former President of the Olympic Council of Ireland is to get his passport back - but not until he pays a sizable bail bond.
He has strongly maintained his innocence since he was arrested in Brazil on ticket touting charges during this year's Olympic Games in Rio de Janeiro.
Until now the 71-year-old has since been unable to return home to Ireland. However last night a judge ruled he should be given back his passport and allowed to leave Brazil for medical care.
He's also been ordered to continue to comply with the legal process.
The judge noted there is a risk Mr Hickey won't return to Brazil but she said she has to balance this with concerns for his health.