RIO DE JANEIRO: Brazil’s Supreme Court handed former President Luiz Inacio Lula da Silva a victory on Thursday, ruling against returning a corruption investigation involving the ex-leader to a judge he accuses of unfairly targeting him.

Brazil’s highest court voted 8-2 to take over the case, effectively removing the probe into Silva from Judge Sergio Moro, the lower court magistrate spearheading a corruption case centred on state-run oil company Petrobras.

Moro, a judge from the provincial backwater of Curitiba, has risen to prominence over the past two years while presiding over the Petrobras investigation that has ensnared some of Brazil’s richest businessmen and top public figures from across the political spectrum.

But he was accused of partisanship earlier this month after ordering police to take Silva in for questioning in connection with the Petrobras case.

Silva’s supporters say Moro is waging a crusade against the former leader and fear he could order Silva detained, a step the Supreme Court is thought much less likely to take, at least in the short term.

The full court has not yet taken up appeals of a separate injunction that prevented Silva from taking office as President Dilma Rousseff’s chief of state, a post that would give him greater legal protections. Under Brazilian law, only the Supreme Court can authorise the investigation, detention and indictment of Cabinet ministers and legislators.

Silva’s appointment has remained in limbo for weeks, pending a decision by the Supreme Court. The former president, who served from 2003-2010, has denied all wrongdoing.

Meanwhile Thursday, demonstrators gathered in more than 20 states to support Silva and Rousseff, who is facing impeachment proceedings over accusations she violated fiscal laws. Thousands of demonstrators — many dressed in red, the symbol of Rousseff’s left-leaning Workers’ Party — converged in the capital, Brasilia, as well as the financial centre of Sao Paulo and other cities throughout the country.

Rousseff’s chance of surviving impeachment effort looked slimmer after the biggest party in her governing coalition decamped earlier this week — a move that also created confusion about the status of her Cabinet.

Leaders of The Brazilian Democratic Movement Party, known by the Portuguese initials PMDB, said Tuesday that all their Cabinet ministers, as well as hundreds of other federal government employees, would have to resign immediately.

But Agriculture Minister Katia Abreu, a close confidant of Rousseff, said on Twitter that she didn’t plan on leaving either the government or the party. Her tweet suggested the other five PMDB Cabinet ministers held the same stand.

It wasn’t immediately clear how the PMDB — Brazil’s largest party — would respond to the minister’s defiance.

Rousseff’s office announced late Wednesday that Sports Minister George Hilton had asked to leave the position and would be temporarily replaced by a top ministry official.

Hilton’s departure is unlikely to have much effect on preparations for the August 5-21 Olympics as his role in the project was marginal. The presidential palace said in a statement that Hilton’s replacement, 45-year-old Ricardo Leyser, had headed the agency responsible for coordinating the federal government’s role in the Olympics.

Wednesday’s announcement capped weeks of confusion about whether Hilton would stay on as minister. He left his party after it also pulled out of Rousseff’s governing coalition in March, in an apparent bid to keep his job. But a top Rousseff aide said last week that Hilton would resign, although his ministry declined to confirm it at the time.

Brazilian news media have suggested Rousseff planned to offer the vacated ministries to the six smaller parties that remain in her coalition in a bid to help her secure their support against impeachment efforts. She needs 172 out of 513 votes in the lower house to bury the proceedings.

But the defection of the PMDB, which has been a key part of the governing coalitions since Brazil emerged from military dictatorship in 1985, appears to have made that more difficult.

Rousseff’s approval rating has plummeted amid the worst recession in decades, rising unemployment and an outbreak of the Zika virus, which has been linked to a rare birth defect.