Brazil's Supreme Court on Thursday upheld last month's ruling by one of its chambers that former judge Sergio Moro was "biased" in convicting ex-president Luiz Inacio Lula da Silva of corruption in 2017.
The previous decision by the court's second chamber, with a 3-2 majority, was a boost to Lula's hopes of a political comeback ahead of presidential elections in 2022.
It came two weeks after one of the court's judges had annulled Lula's convictions on procedural grounds.
Socialist Lula, 75, claimed his conviction was politically motivated in a bid to prevent him from running against President Jair Bolsonaro in the 2018 election that brought the far-right politician to power.
Thursday's decision is another blow to the Operation Car Wash corruption investigation that felled a Who's Who of top politicians and business executives accused of conspiring to embezzle billions of dollars from state oil company Petrobras.
In 2017, Moro convicted Lula of accepting a luxury apartment in Sao Paulo as a bribe.
An appeals court upheld his conviction, preventing him for running for president as he spent 18 months in jail.
Lula led Brazil through an economic boom from 2003 to 2010, and remains one of its most popular politicians -- though his image was badly tarnished when he was sentenced to a total of 26 years.
At least seven of the Supreme Court's 11 judges were in support of the second chamber's decision on technical grounds, without considering its merits.
Lula's defense has argued that Moro's political bias was evident when he was appointed justice minister by Bolsonaro.
The Supreme Court annulled Lula's convictions from a court in the southern city of Curitiba for technical reasons, ruling that Moro did not have jurisdictional authority given the accusations were not directly linked to Petrobras.
Four cases implicating Lula that were heard in the Curitiba court have been transferred to a federal court in the capital Brasilia.
But since his convictions have been annulled, Lula is once again eligible to run for office.
He is expected to be a major rival to Bolsonaro's hopes of re-election, although he has yet to comment on whether he intends to run.