Former Brazilian President Luiz Inacio Lula da Silva, a leftist leader who is topping polls for the 2018 election, has told his supporters protesting his conviction for corruption charges that his political opponents were persecuting him in the courts.

In the main avenue of Sao Paulo, the biggest city in Brazil, Lula took aim at Judge Sergio Moro, who sentenced him to nearly 10 years in prison but allowed him to remain free on appeal, and the prosecutors leading the so-called Car Wash corruption investigation.

"Since they're not able to defeat me through politics, they want to defeat me with lawsuits," he said on Thursday.

Police declined to estimate the number of people attending the protests in Sao Paulo, which Lula's Workers Party helped organise.

Smaller rallies took place in other major cities, including Rio de Janeiro, Belo Horizonte, Porto Alegre and Fortaleza.

During his two terms as president between 2003 and 2010, Lula, a former union leader, helped to lift millions from poverty in Latin America's largest economy.

But he has also been blamed for boosting the public deficit as a spending spree aimed at tackling the global financial crisis extended for years to come.

If an appeals court upholds Lula's conviction, a ruling which is expected to take at least eight months, Lula will be barred from running for office next year.

Apartment 'bribe'?

Lula has repeatedly denied taking any bribes during or after his presidency. He has described the investigation against him by Judge Moro as a campaign to prevent his return to power.

Part of the probe focused on allegations that Lula received a luxury seaside apartment as a bribe from one of Brazil's biggest construction companies, OAS.

OPINION: The scandal and tragedy of Lula's corruption conviction

Judge Moro said Lula had illegally received $1.1m.

"Between the crimes of corruption and money laundering, there are sufficient grounds for sentences totalling nine years and six months of incarceration," Moro said in his verdict.

The sentence by Moro, whose wide popularity for his anti-corruption work has prompted some to see him as a possible presidential candidate, fed into broader political fissures in Brazil.

Lula's chosen successor, Dilma Rousseff, was impeached and removed from office last year, with her vice president, Michel Temer, taking over the reins.

Temer himself is battling for his own political survival after being charged with taking bribes.

Two weeks ago, Moro sentenced an influential minister in the governments of Lula and Rousseff, Antonio Palocci, to 12 years in prison for corruption.

Palocci played a central role in the "Car Wash" scheme, most of which unfolded when Lula's Workers' Party was in power from 2003 to 2016.

Prosecutors said Palocci was a point man in the flow of "bribes between the Odebrecht construction group and intermediaries of the Workers' Party," laundering more than $10m used for party campaign finances.

Odebrecht, an industrial conglomerate with projects around the world, named Palocci "the Italian" in its list of code names for politicians regularly taking bribes in exchange for lucrative contracts with Petrobras and other favours.