(CNN)Brazil's top electoral court has barred former President Luiz Inacio Lula da Silva from running for reelection because of a corruption conviction, just weeks before Brazilians go to the polls for a vote in which he was considered a frontrunner despite being in prison.
Top Brazilian court bars Lula da Silva from running again for president
Six of seven justices from the Supreme Electoral Tribunal in Brasilia ruled that Lula was ineligible to run in October, while one voted in favor in a hearing stretching late into Friday night.
Brazilian law bars candidates whose conviction has been upheld on appeal.
Universally known as Lula, Lula da Silva is a founding member of Brazil's only socialist political party, Partido dos Trabalhadores (PT), the Workers' Party.
A former metalworker and union leader, he rose through the political ranks to serve two terms as president between 2003 and 2011. He left office with a 90% approval rating, after his policies helped to lift millions of Brazilians out of poverty.
But he has been in jail since April after he was sentenced to 12 years for corruption and money laundering. The accusations against him emerged after he left office in 2011.
The 72-year-old has strongly denied any wrongdoing. His defense said he was a victim of political persecution.
Lula da Silva's lawyers can appeal the latest court decision.
The Workers' Party said in a statement: "We will present all the appeals to the courts so that the political rights of Lula, as provided by law and in international treaties ratified by Brazil, are recognized."
Lula da Silva has been in prison since he surrendered to federal police in April. Since then, PT politicians and supporters have held rallies calling for his release and claiming his innocence.
He was registered as the PT's candidate in the upcoming vote in August.
At the time, he said in a statement on his official website that he had submitted his candidacy "with the certainty that I can do much to take Brazil out of one of the worst crises in history."
He also accused political opponents of convicting him without evidence in an attempt to take him out of the election.