(Bloomberg) -- Brazil’s top court ruled that convicted criminals should be jailed only after all of their appeals are exhausted, a move that may allow high-profile prisoners, including former President Luiz Inacio Lula da Silva, to walk free.

The 6-5 decision on Thursday reinforces one of the principles of the Brazilian Constitution and reverses the recent practice of jailing criminals whose convictions were upheld on a first appeal -- a practice that was instrumental in the success of the Carwash anti-corruption probe.

The decision stands to generate a wave of public anger, particularly among government supporters incensed by the prospect of Lula leaving jail. The former president was convicted of corruption in 2017 and lost two appeals since then, but he has not exhausted the entire process. Dozens of Senators and deputies, as well as members of President Jair Bolsonaro’s own family and advocacy groups have pressured the court to keep the status quo.

‘Unfairly Jailed’

Lula’s defense said it plans to request his immediate release. The Supreme Court’s decision shows that the former president has been “unfairly jailed for 579 days,” his lawyers wrote in a statement.

Fireworks exploded near the Supreme Court in Brasilia as Lula’s supporters celebrated the decision. Argentina’s President-elect Alberto Fernandez also welcomed the ruling, posting on Twitter: #FreeLulaTomorrow!

The leader of Bolsonaro’s party in the Senate, Major Olimpio, said the decision was cause of “shame” and that the top court’s justices “voted in favor of criminals and against the Brazilian people.”

The ruling can benefit many wealthy and powerful prisoners brought down by Carwash, who will now seek to extend the appeals process to stay out of jail. Brazil’s National Justice Council estimates the decision could free as many as 5,000 prisoners.

(Updates with statement from Lula’s defense, comments from Bolsonaro’s ally.)

--With assistance from Simone Iglesias.

To contact the reporters on this story: Samy Adghirni in Brasilia Newsroom at sadghirni@bloomberg.net;Flavia Said in Brasilia at fsaid7@bloomberg.net

To contact the editors responsible for this story: Walter Brandimarte at wbrandimarte@bloomberg.net, Matthew Malinowski

For more articles like this, please visit us at bloomberg.com

©2019 Bloomberg L.P.