Updated

Former President Luiz Inacio Lula da Silva has been barred from Brazil's October presidential election by the country's electoral court despite easily leading in the polls — a ruling that adds uncertainty to the race to lead Latin America's largest nation, leaving no clear favorites.

In a session that stretched into the early hours of Saturday, the justices voted 6-1 against the once hugely popular president, who is imprisoned on a corruption conviction he claims is a sham.

Da Silva's left-leaning Workers' Party issued a statement vowing to appeal, but there appeared to be scant chance it would succeed. That would seem to leave the party's fortunes in the hands of its current vice presidential candidate Fernando Haddad, a former Sao Paulo mayor who so far has polled in single digits and would have to count on the borrowed charisma of da Silva to succeed.

Supreme Court Justice Luis Roberto Barroso cast the first vote against da Silva, saying the ruling was "very simple" because the law forbids candidates whose conviction has been upheld on appeal.

"There is no margin here for the electoral court to make any other evaluation but the one showing there is a conviction, and that conviction matters in the candidate's eligibility," Barroso said.

Justice Edson Fachin disagreed, citing a recent call by a U.N. human rights committee calling for da Silva to be allowed to run while he further appeals his conviction.

Even as the justices were debating, the Workers' Party put out ads on social media channels featuring da Silva, holding fast to a strategy to keep the former president front and center as long as possible.

The former firebrand union leader led Brazil during a booming period from 2003 and 2010, promoting social policies that pulled millions from poverty. U.S. President Barack Obama once called him the "most popular politician on earth."

But da Silva and party have lost much of that appeal over the last several years due to a stumbling economy under his hand-picked successor Dilma Rousseff and a sprawling corruption probe that has ensnared many top businessmen and politicians, including da Silva.

The 72-year-old ex-president is serving a 12-year-sentence for corruption and money laundering after being convicted of trading favors with construction company Grupo OAS in exchange for the promise of a beach house apartment.

Justice Barroso said the Workers' Party should replace da Silva within 10 days, and that he should not appear as a presidential candidate in free airtime that is given to political parties on nationwide TV and radio starting on Saturday.

In a statement late Friday, the Workers' Party said it would appeal the electoral court ruling, just as da Silva is fighting to overturn his corruption conviction.

With da Silva out of the race, Haddad was expected to take his place on the Workers' Party ticket. Polls show tepid support for his bid, but the party hopes da Silva's popularity could boost the former mayor's hopes.

On Saturday, Haddad was scheduled to visit Garanhuns, a city in Brazil's impoverished Northeast where da Silva was born.