A Brazilian judge has ordered the release of ex-President Luiz Inacio Lula da Silva (known as “Lula”).
The judge said the left-wing politician must be released from prison in Curitiba while an appeal process is carried out.
In April, Lula was sentenced to 12 years and one month in prison for corruption and money laundering.
He has always declared his innocence, saying the conviction was politically motivated.
Polls conducted before he was jailed in April suggested that Lula was the frontrunner for the presidential elections, which will be held in October.
The 72-year-old was jailed after a close vote, with six Supreme Court justices in favour of jailing him and five against.
The conviction followed an anti-corruption investigation known as Operation Car Wash, which has implicated top politicians from several parties.
Lula led the country for the Workers’ Party from January 2003 to December 2010.
He is known as a divisive figure. Thousands of people took to the street earlier this year to call for his immediate imprisonment, while his supporters also turned out in large numbers, insisting he should be freed.
His jailing was controversial as defendants in Brazil were previously allowed to remain free until their final appeal had been exhausted.
However, the Supreme Court sided with a 2016 ruling from a lower court, under which defendants could be sent to jail after a failed first appeal.
Lula lost his first appeal in January, when the appeals court not only upheld his conviction, but increased the sentence from nine-and-a-half years to 12.
What is Operation Car Wash?
In 2014, after Lula left office, prosecutors started investigating allegations that executives at the state oil company Petrobras had accepted bribes in return for awarding contracts to construction firms.
Operation Car Wash uncovered a huge web of corruption involving top-level politicians from a broad spectrum of parties taking kickbacks.
Lula was convicted of receiving a renovated beachfront apartment worth some 3.7m reais ($1.1m; £790,000), as a bribe by engineering firm OAS.
The defence says Lula’s ownership of the apartment has never been proven and that his conviction rests largely on the word of the former chairman of OAS, himself convicted of corruption.