Top electoral court rules jailed former president cannot run in October’s election because of his graft conviction.

Brazil‘s top electoral court has barred jailed former President Luiz Inacio Lula da Silva from running in October’s presidential elections because of his corruption conviction.

In a session that stretched into the early hours of Saturday, the justices voted 6-1 against the once hugely popular leader, who has been incarcerated since April for accepting a bribe.

Supreme Court Justice Luis Roberto Barroso cast the first vote against Lula, 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 UN human rights committee calling for Lula to be allowed to run while he further appeals his conviction.

Moments later, his Workers’ Party vowed to “fight with all means to secure his candidacy”.

“We will present all appeals before the courts for the recognition of the rights of Lula provided by law and international treaties ratified by Brazil,” said the party in a statement.

“We will defend Lula in the streets, with the people.”

Lula, 72, is serving a 12-year sentence for accepting a luxury seaside apartment as a bribe from a construction firm.

He was found guilty in July 2017 and then lost his first appeal in January.

The former trade union leader vehemently denies the accusations and has dismissed the charges as a political plot aimed at preventing him from standing in the elections.

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.

But his Workers Party registered him as its presidential candidate for the October 7 vote anyway, saying he is innocent.

Despite his conviction and several graft cases pending against him, Lula leads the race by a long stretch, with 39 percent of voter support, according to pollster Datafolha.

His nearest rival, far-right candidate Jair Bolsonaro, has 19 percent.

Paulo Sotero, director of Woodrow Wilson Center’s Brazil Institute, told Al Jazeera the Worker’s Party has until September 17 to replace their candidate, though the court gave it 10 days to make the change.

“There is a cutoff date in Brazilian law – September 17 – and the party will have that as a limit for the party to replace their candidate.

“It is a political calculation that Lula and his partners at the Worker’s Party will have to make. And they may delay this decision until the very last minute, [or] they may decide tomorrow or day after to replace Lula with … Fernando Haddad, former mayor of Sao Paulo,” he said.

Polls show tepid support for the vice presidential running mate Haddad’s bid, but the party hopes Lula’s popularity could boost the former mayor’s hopes.

The electoral 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.