SÃO PAULO, Brazil — After vowing for months that a conviction on corruption charges would not stand in the way of his bid for a third term as Brazil’s leader, former President Luiz Inácio Lula da Silva surrendered to the police on Saturday evening to begin serving a 12-year sentence.
His imprisonment was an ignominious turn in the remarkable political career of Mr. 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, Mr. 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 Mr. da Silva’s handpicked successor, Dilma Rousseff. She was replaced by Mr. Temer, a deeply unpopular center-right politician who also stands accused of corruption.
Before surrendering to federal police authorities, Mr. 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 Mr. da Silva, sounding hoarse, told a throng of supporters gathered outside a metalworkers union headquarters outside of São Paulo.
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.
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.
Mr. 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.
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 Mr. 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.”
Mr. da Silva 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 Obama, during a meeting of heads of state in London in 2009, called Mr. da Silva “the most popular politician on Earth.”
Brazil appeared to be on a breathtaking rise when Mr. Lula 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 Ms. Rousseff’s impeachment, which deeply polarized Brazilians.
The charges Mr. da Silva were 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 O.A.S.
After a three-judge panel upheld the conviction in January, Mr. 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.
Mr. 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.
Mr. 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.
He will not be held with ordinary prisoners, but will be down the hall from two other high-profile Car Wash defendants, former allies of Mr. da Silva who cut deals with prosecutors and implicated Mr. da Silva in corrupt dealings.
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 Mr. Temer by a samba school during the recent Carnival parade in Rio de Janeiro. “We get really sad.”
Mr. Amorim added that Brazil has become “totally forgotten” on the international stage. “No one is interested in knowing Brazil’s opinion anymore,” he said.
Shasta Darlington reported from São Paulo, Ernesto Londoño from Rio de Janeiro, and Manuela Andreoni from Curitiba, Brazil.