RIO DE JANEIRO — It was anything but a surrender.

At times jovial and defiant, the former president of Brazil, Luiz Inácio Lula da Silva, stood before a crowd of cheering supporters, painting himself as the victim of a deceitful judiciary that had wandered dangerously into politics.

“If they think that with this sentence they will take me out of the game, let them know that I’m in the game,” Mr. da Silva said on Thursday, a day after his conviction on corruption and money laundering charges threatened his bid for a third presidency.

Corruption investigations have discredited virtually every powerful political force in Brazil, upending the country before presidential elections next year.

Now political adversaries on very different sides of the ideological spectrum are relying on the same survival strategy: attacking the legitimacy of prosecutors and judges who have set out to dismantle the culture of corruption that Brazilian politicians have institutionalized over decades.