Former Brazilian President Luiz Inácio Lula da Silva has pulled out of next month's presidential election, allowing his running mate to stand in his place, reports BBC.
Workers' Party leader Gleisi Hoffman announced the decision outside the police headquarters where the 72-year-old is serving a 12-year sentence.
Brazil's top electoral court barred Lula's candidacy less than two weeks ago due to his corruption conviction.
The move comes days after a far-right candidate was stabbed at a rally.
The 63-year old Jair Bolsonaro must now undergo major surgery after being attacked by a lone assailant, doctors said.
A letter written by Lula in his prison cell was read out to his supporters who have been camping outside the jail for five months demanding he be freed.
In it, the former president, who governed from January 2003 until December 2010, said he would not run in the election scheduled for 7 October.
He also named Fernando Haddad as the man to step into the breach.
The decision comes after a lengthy legal battle which culminated on 31 August when the Superior Electoral Court (TSE) ruled that he was "ineligible" to run for the presidency.
Lula's legal team and the Workers' Party have appealed against the decision and the Supreme Court is still due to rule on it.
Up until Monday night, the Workers' Party strategy had been to keep Lula's name on the ticket for as long as possible.
Lula left office with record approval ratings and despite his imprisonment, almost 40% of people asked by polling firm Datafolha said they would vote for him.
Haddad, on the other hand, is a former education minister who has little name recognition outside of São Paulo, where he served as mayor.
Lula's legal team asked the Supreme Court to extend the deadline for registering candidates for the presidency from end of business Tuesday to Monday 17 September to buy itself more time.
Lula was barred from running for the presidency under a 2010 law dubbed "Clean Slate". It prohibits those who have a criminal conviction which has been upheld on appeal from running for public office.
In July 2017, Lula was found guilty of accepting an upgrade to a beachfront flat as a bribe from an engineering firm involved in a major corruption scheme.
Lula has always denied any wrongdoing and appealed against the verdict.
In January, an appeals court upheld the conviction and increased the sentence from the original nine-and-a-half years to 12 years.
Lula and his legal team tried to argue he should stay out of jail while further appeals were under way.
But in April, he was given 24 hours to turn himself in. After a tense, two-day stand-off he surrendered to police and was taken to the federal police headquarters in the city of Curitiba, where he has been held since.