A Supreme Court judge in Brazil issued a ruling that might have released former president Luiz Inácio Lula da Silva from jail – only to see it overturned by the court's president.
Justice Marco Aurélio Mello had ruled that a convicted criminal with a court appeal pending should be freed until the legal process has been exhausted.
That would apply to 1,500 prisoners, including Lula who has been in prison since April on corruption charges.
But the chief judge intervened.
Chief Justice Jose Antonio Dias Toffoli said he had approved an objection by public prosecutors against Justice Mello's order.
This all happened on the day the court was going into recess for the Christmas holidays.
How did events unfold?
Justice Mello made the unexpected ruling on the issue of imprisoning people whose conviction has been upheld on first appeal – as is the case with Lula.
He said they should be allowed to remain out of prison until the final appeal had been heard, a legal process that could take years.
The judge said a request for release should be made by the prisoner's lawyer to the court that had found them guilty.
Gleisi Hoffmann, head of the Workers Party that Lula founded, tweeted soon after the announcement that lawyers had already put in a request for the former president's release.
But a while later Chief Justice Toffoli rejected the ruling, saying it would be taken up by the full Supreme Court panel of 11 judges after the holiday break.
The full panel of Supreme Court judges is deeply divided on the issue of whether convicted criminals remain free during the lengthy appeals process.
They were due to meet in April next year to make a decision on the issue.
Who is Justice Mello?
By Leonardo Rocha, BBC World Service Americas Editor
Marco Aurélio Mello was appointed to the Supreme Court in 1990 by his cousin, then President Fernando Collor de Mello.
He has since established a solid reputation in Brazil's highest court, brushing off any allegations of nepotism.
Mr Mello has repeatedly sided with lawyers representing former President Lula on this matter, but there is no suggestion of a political or ideological bias behind his position.
He believes that Lula's arrest, and that of many other prisoners, infringes basic principles of the Brazilian constitution.
Judge Mello says that anyone still appealing against their sentences should have the right to await in freedom all legal avenues are exhausted.
Why was Lula imprisoned?
Lula was convicted, in July 2017, of accepting a bribe and was sentenced to more than nine years in jail which, on appeal, was increased to more than 12.
He also faces other charges of money laundering, influence peddling and obstruction of justice.
The former president – who was president from 2003 to 2011 – has always denied the allegations, claiming they are politically motivated.
He said they were designed to prevent him from running for president in October, amid polls showing him to be the frontrunner. The election was won by far-right candidate Jair Bolsonaro, who takes office on 1 January 2019.
Brazilians are deeply divided over the imprisonment of their former president, so this news is being watched by everyone, the BBC's South America correspondent Katy Watson reports.