Former Brazilian President Luiz Inacio Lula da Silva has abandoned presidential run.
CNN  — 

Imprisoned former Brazilian President Luiz Inacio Lula da Silva abandoned his party’s presidential bid on Tuesday, weeks before an election in which he was considered a front-runner.

Running mate and former Sao Paulo Mayor Fernando Haddad will take Lula’s place on the October 7 ballot, according to Lula’s Workers’ Party.

The switch comes after the country’s top electoral tribunal barred the convicted former head of state from running.

In a letter, Lula urged his supporters to now back his running mate.

“We are already millions of Lula’s and from now on, Haddad will be Lula for millions of Brazilians,” he wrote.

The Superior Electoral Court had given the party until Tuesday to name Lula’s replacement on its presidential ticket, state-run Agencia Brazil news reported.

The Workers’ Party made the announcement Tuesday in the southern city of Curitiba, where the former president was running a behind-bars campaign while serving his sentence.

The party’s official Twitter account featured images of Lula and Haddad calling Lula “the best president that Brazil ever had” and asking voters to “overcome the injustices” with unity.

Haddad will face Jair Bolsonaro, 63, in the election. Bolsonaro’s campaign has been interrupted since last week, after he was stabbed during a rally while campaigning.

The far-right candidate, known to many of his countrymen as the “Brazilian Trump,” will likely be unable to resume campaigning ahead of October’s vote, his son has said, while urging supporters to continue on Bolsonaro’s behalf.

Police arrested and charged Adelio Bispo de Oliveira, 40, in connection with the attack.

Lula was seeking a third term as president

Universally known as Lula, Lula da Silva is one of his country’s most popular politicians and a founding member of Brazil’s only socialist political 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 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.

Earlier this month, Brazil’s top electoral court barred Lula da Silva from running for re-election because of the corruption conviction.

Six of seven justices from the Supreme Electoral Tribunal in Brasilia ruled that Lula was ineligible to run.

Brazilian law bars candidates whose conviction has been upheld on appeal.

Lula da Silva has been in prison since he surrendered to federal police in April. Since then, Workers’ Party politicians and supporters have held rallies calling for his release and claiming his innocence.

His conviction stemmed from a wide-ranging corruption investigation into the state-run oil company Petrobras, dubbed “Operation Car Wash.”

Lula da Silva was accused of benefiting from the renovation of a triplex in a beach town near Sao Paulo by the construction company OAS.

The charges were connected to 3.7 million reais’ worth of bribes ($1.1 million) received from OAS through the beachfront apartment. In return, Lula da Silva helped the builder acquire contracts from the oil company, prosecutors charged.

Lula da Silva was initially found guilty of the charges in July 2017.

In January, an appeals court unanimously upheld the corruption and money laundering charges against him, and he was handed the prison sentence.

He was first questioned by police about the corruption allegations in March 2016. Lula da Silva’s wife, Marisa Leticia Lula da Silva, who died in February 2017, and six others also were charged.

Born into a working class family, Lula da Silva left school and began working at age 12. Unhappy with the lack of political representation of the working class in Brazil, he decided to get involved in politics and helped found the Workers’ Party in 1980.

Journalist Marcia Reverdosa in Sao Paulo, Brazil, and CNN’s Laura Smith-Spark and Taylor Barnes contributed to this report.