Brazil’s former President Luiz Inácio Lula da Silva has been freed from jail.
A judge ordered the release of Lula after the Supreme Court ruled that convicted criminals should go to prison only if they have exhausted their appeal options.
He was mobbed by supporters outside a prison in the city of Curitiba where he has been held for a year and a half on corruption charges.
The left-winger led Brazil between 2003 and 2010 and remains popular.
“I didn’t think that today I could be here talking to men and women that during 580 days shouted good morning, good afternoon or goodnight, no matter if it was raining or 40 degrees (Celsius),” Lula told the crowds.
He was favourite to win last year’s presidential election but was imprisoned after being implicated in a major corruption scandal. The race was won instead by far-right candidate Jair Bolsonaro.
Lula will be barred from standing for office because of his criminal record.
He has consistently denied all the accusations against him and claims they are politically motivated.
How did the release come about?
Justices voted to reinterpret the country’s penal code in a decision issued on Thursday.
It overturns a three-year-old rule which mandated immediate prison time for convicted criminals after they lost their first appeal.
A politician who stirs emotions
By Katy Watson, BBC South America correspondent
For Lula’s supporters, this feels like vindication – he’s a politician who stirs emotions and those who back him feel that this has been a political witch-hunt from the very beginning.
There’s no guarantee Lula will remain free forever – he may not win the appeals that are left – and he’s also been accused of corruption in other cases which he will have to face justice for.
But with Lula now free, it will strengthen the left in Brazil – and harden the right. President Jair Bolsonaro doesn’t hide his disdain for Lula and millions of people agree – the anger towards Lula and the Workers Party is what propelled Mr Bolsonaro to power in the first place.
Brazil’s corruption scandal, known as Operation Car Wash, initially centred on the state-run oil company Petrobras, but subsequently billions of dollars of bribes were uncovered – and dozens of high-profile business leaders and politicians were jailed.
The mandatory imprisonment rule was seen as helping prosecutors secure convictions and unravel the scandal by encouraging suspects to negotiate plea deals.
But critics claimed it violated Brazil’s constitution – which states that no one can be deprived of their liberty without due process of law.
Lula was jailed in 2018 after being sentenced to more than 12 years in prison, later reduced to eight years and 10 months, for receiving a beachside apartment from an engineering company implicated in the Car Wash investigation.
Earlier this year, he was sentenced to another 12 years after being found guilty of accepting bribes in the form of renovation work at a country house from construction companies.