The decision means thousands of convicts could be released from prison, including Lula, who is among dozens of political and business leaders caught up in a sprawling corruption probe.

They would remain free until they had exhausted their rights to appeal their conviction -- which critics say could take years in cases involving people with deep pockets.

Lula's lawyers demanded the "immediate release" of the former president.

The 6-5 decision to overturn the three-year-old ruling is a blow to investigators in the so-called Car Wash probe, which is supported by many ordinary Brazilians fed up with corrupt leaders.