Former Brazilian president Luiz Inacio Lula da Silva has walked free from jail after a year-and-a-half behind bars for corruption following a court ruling that could release thousands of convicts.

He pumped his fist as he exited the federal police headquarters in the southern city of Curitiba and was quickly mobbed by hundreds of supporters and journalists.

In an impassioned address in a sometimes hoarse voice, Lula vowed to keep fighting for poor people and denounced the economic policies of current president Jair Bolsonaro.

"People are hungrier, they have no jobs, people work for Uber or delivering pizzas on a bike," Lula said in remarks sometimes drowned out by cheers from the crowd and fireworks overhead.

Lula's highly anticipated exit from the facility where he had been held since April 2018 came hours after his lawyers requested the immediate release of the 74-year-old, who had been serving a nearly nine-year sentence for corruption and money laundering.

Mr da Silva addressed a crowd waiting for him upon his release

Late Thursday, the Supreme Court overturned a rule requiring convicted criminals to go to jail after losing their first appeal. Mr Lula is one of several thousand convicts who could benefit from the decision.

Those convicts would remain free until they had exhausted their rights to appeal - a process critics say could take years in cases involving people able to afford expensive lawyers.

Many of those affected by the ruling are political and business leaders caught up in a massive corruption probe dubbed Car Wash that began in 2014.

The Supreme Court ruling had given Mr Lula  "hope that there could be justice," his lawyer Cristiano Zanin said.

"Our judicial battle continues, our focus is to get the legal case nullified." 

Lula, who led Brazil through a historic boom from 2003 to 2010, earning him the gratitude of millions of Brazilians for redistributing wealth to haul them out of poverty, was serving eight years and 10 months for corruption.

He was sentenced to almost 13 years in jail in February in a separate corruption case and still faces another half dozen corruption trials.

Lula has denied all the charges, arguing they were politically motivated to keep him out of the 2018 presidential election that was won by Mr Bolsonaro.

Brazil's President Jair Bolsonaro

Justice Minister Sergio Moro, who convicted Lula when he was a judge in 2017, said the Supreme Court's decision must be respected, but he noted "Congress can modify the Constitution or the law" to allow the jailing of convicted criminals after their first appeal.  

Venezuela's President Nicolas Maduro led many leftist leaders in Latin American in cheering Lula's release, saying "the Venezuelan people are happy and welcome Lula's freedom."

US presidential hopeful Bernie Sanders said that in Brazil no one had done more than Lula to reduce poverty and defend workers.

"I am delighted that he has been released from jail, something that never should have happened in the first place," Mr Sanders tweeted.

Even though he has been freed, Lula's criminal record will prevent him from resuming his political career. He was the founder of the Workers Party (PT). 

That could change, however, if the Supreme Court were to decide in a separate case that Mr Moro had been biased.

Lula's release could invigorate the left and, paradoxically, also help President Bolsonaro, who was swept to power in 2018 on a wave of anti-PT sentiment, said Thomaz Favaro of Control Risks consultancy.

"You will have Lula more present on the political scene and that allows Bolsonaro to reinforce his role as leader of the anti-PT field," Mr Favaro said.

Lula will spend his first day of freedom visiting the metalworkers' union he once led near Sao Paulo, Brazil's biggest city.