The prosecution, Mr. da Silva charged, was an effort to thwart his vision of a country in which ever more poor people could enroll in universities, go on vacation and buy cars and homes.

“If that was the crime I committed, I want to say that I will continue being a criminal because we’re going to accomplish much more,” Mr. da Silva shouted to a crowd that had spent much of the morning chanting that he should not surrender.

During his last hours of freedom, Mr. da Silva appeared to acknowledge that his political career is over — at least for now.

“You will have to transform yourselves,” he told supporters. “They must know that the death of a combatant doesn’t end a revolution.”

Months away from Election Day, Brazil’s political left now finds itself without an obvious standard-bearer.

Mr. da Silva did not anoint a successor to take his place on the ballot, suggesting that Workers’ Party leaders have yet to decide who stands the best chance of filling the void.

But, notably, he did single out for compliments two leftist presidential hopefuls from other parties who were with him on stage, Manuela d’Ávila and Guilherme Boulos.