Brazil's top electoral court on Friday barred jailed former president Luiz Inacio Lula da Silva from running in this year's presidential race because of his corruption conviction.
The widely expected decision removes a cloud hanging over Brazil's most uncertain election in decades - though Lula's lawyers have said they would appeal an adverse decision to the Supreme Court.
"What is at stake here today is the equality of all citizens before the law and the Constitution," Judge Og Fernandes told the court in his vote to declare Lula ineligible.
Judge Admar Gonzaga, who as a lawyer worked for Lula's handpicked successor Dilma Rousseff's 2010 election, cast the decisive vote in the 6-1 decision that sealed the leftist icon's ejection from the presidential election.
Lula, Brazil's most popular politician, is serving a 12-year sentence for a corruption conviction. His Workers Party registered him as its presidential candidate for the October 7 vote anyway, saying he is innocent.
Lula is ineligible for office under Brazil's "Clean Slate" law, which prohibits candidates from running if they have convictions that have been upheld on appeal.
Despite his conviction and several graft cases pending against him, Lula leads the race by a long stretch, with 39% of voter support, according to pollster Datafolha. His nearest rival, far-right candidate Jair Bolsonaro, has 19%.
Ads by the Workers Party calling on Brazilians to vote for Lula began to appear on social media on Friday, and will be shown on television as of Saturday when the race enters its final 35 days of campaigning.
Vice-presidential running mate Fernando Haddad, a former mayor of Sao Paulo, is expected to head the ticket hoping to inherit the bulk of Lula's votes.
The party has until September 17 to swap their names on the ballot, though the court gave it 10 days to make the change.
The court also ruled that Lula should not appear in the Workers Party's television and radio ads campaign until the ticket has been officially altered to remove him.
The court on Thursday had rejected another request by opponents of Lula to exclude his name from opinion polls.