His imprisonment was an ignominious turn in the remarkable political career of da Silva, the son of illiterate farmworkers who faced down Brazil’s military dictators as a union leader and helped build a transformational leftist party that governed Brazil for more than 13 years.

His detention was also a momentous development in the coming election in Brazil, upending the race to replace President Michel Temer in October.

Having carved out a sustained and ample lead in the polls, da Silva promised his followers that the Workers’ Party could once again wrest control of Brazil’s destiny, and prioritize policies to narrow the country’s steep inequality.

Succeeding would have been a stunning comeback after the 2016 impeachment of da Silva’s hand-picked successor, Dilma Rousseff. She was replaced by Temer, a deeply unpopular center-right politician who also stands accused of corruption.

Da Silva is the first former Brazilian president to be remanded into custody since democracy was restored in the mid-1980s and the first former president to have been convicted of corruption.

His imprisonment represents perhaps the biggest triumph in the yearslong effort by a team of crusading judges and prosecutors to upend the endemic graft that has long been a staple of politics and deal making in Brazil.

Before surrendering to federal police authorities, da Silva, 72, accused prosecutors and judges of knowingly pursuing a baseless case against him.

“I do not forgive them for creating the impression that I am a thief,” an indignant da Silva, sounding hoarse, told a throng gathered outside a metalworkers union headquarters outside of São Paulo. For hours on Saturday, in a tense standoff, his ardent supporters had physically blocked his surrender, before finally allowing him to leave.

The prosecution, 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,” 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, 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.

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.

Other candidates who remain in the race include Jair Bolsonaro, a far-right lawmaker who has campaigned on a promise of resorting to harsh tactics to restore security in areas plagued by violence; and a former environmental minister, Marina Silva, who supports the judiciary’s crackdown on corruption and an overhaul of the political system.

But by ending the presidential candidacy of a leader who remains beloved across much of the country, the move by judicial authorities may have called into question the fairness of the October election.

Daniel Aarão Reis, a professor of contemporary history at Federal Fluminense University, said that while da Silva’s prosecution was procedurally sound, it is likely to further shake Brazilians’ faith in democracy, particularly if political rivals who also stand accused of wrongdoing manage to escape accountability.

“It worries me because, whether or not the people who provoked this situation meant it, it’s a blow to democracy,” he said. “Democracy is living a moment of very little prestige.”

“No citizen is above the law, and no one, regardless of how important a leader he may have been, or what position he once held, is entitled to make a mockery of justice,” Brazil’s National Association of Prosecutors said in a statement issued Saturday night. “Institutions are the pillars of democracy.”

Bolsonaro’s reaction to the arrest was minimalist: He tweeted an image of the Brazilian flag.

Da Silva, widely known as Lula, left power in 2011 with extraordinarily high approval ratings at home and a reputation as an effective diplomatic mediator abroad.

Washington initially viewed his rise with apprehension, but his rock star status appeared at its peak when President Barack Obama, during a meeting of heads of state in London in 2009, called da Silva “the most popular politician on Earth.”

Brazil appeared to be on a breathtaking rise when da Silva left office in 2011, poised to cash in on new, enormous oil reserves, and revel in the spotlight that the 2014 World Cup and the 2016 Olympic Games in Rio de Janeiro would cast on the country of almost 210 million people.

But his party’s legacy was marred in 2014, when prosecutors began unraveling a giant, convoluted kickback scheme as part of an investigation that became known as Lava Jato, or Car Wash, that has so far resulted in the conviction of 120 people and billions of dollars in restitution payments.

The investigation crippled the state-run oil company, Petrobras, and the giant construction firm, Odebrecht, and contributed to a devastating recession that paved the way for Rousseff’s impeachment, which deeply polarized Brazilians.

The charges da Silva was convicted of were a small chapter in the annals of Lava Jato. He was found guilty last July of accepting a seaside apartment in return for contracts awarded to the construction company OAS.

After a three-judge panel upheld the conviction in January, da Silva asked the country’s two top courts to allow him to remain free while other appeals were considered, but his petitions were rejected.

Da Silva is slated to start serving the sentence in a specially configured cell at the federal police headquarters in the southern city of Curitiba, a building he was on hand to inaugurate as president in 2007.

Da Silva’s legal team said Saturday night that he would continue to appeal his conviction before Brazil’s top courts. He is a defendant in at least seven other cases.

Da Silva will be detained in a small bedroom with a simple, wooden bed, a small table and two windows on the fourth floor of the building.

As news of his arrest broke shortly before 7 p.m., some Brazilians who opposed his re-election celebrated across the country by setting off fireworks and honking horns.

“Decent Brazilians are celebrating this historic moment. Justice has been served,” João Doria, a former mayor of São Paulo, who is believed to have presidential aspirations, said in a statement.

Supporters saw his imprisonment as a tragic end of an era that had brought enormous hope and pride to Brazil.

“Brazil went from having the pop star of international politics to having a supporting actor for a vampire film,” the former foreign minister Celso Amorim said, referring to a parody of Temer by a samba school during the recent Carnival parade in Rio de Janeiro. “We get really sad.”

Opposing groups of protesters awaited da Silva’s arrival outside the building where he will be held in Curitiba.

A few hundred supporters wearing the Workers’ Party trademark red chanted to the beat of drums “Free Lula,” and sang a jingle from his first presidential campaign in 1989.

A smaller group of critics of the former president, meanwhile, beat pots and pans as they chanted: “Lula, you thief, your place is in prison.”

This article originally appeared in The New York Times.