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.
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.
What has happened with Lula?
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.
Why did he finally give up?
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.
Mr 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.
Typical of the high drama which has characterised the election campaign, Lula and his party decided to change tack after the Supreme Court rejected their request to extend the deadline.
Lula’s long shadow
Katy Watson, BBC South America correspondent
In his letter, Lula says that while a man can be unfairly imprisoned, his ideas cannot be. He’s made it clear he will keep fighting for the party from behind bars.
Lula asked his supporters to vote for Fernando Haddad but he’s a relative unknown, especially in the north-east of the country, a poor part of Brazil that has traditionally been a Lula heartland.
There are less than four weeks left until the first round. The latest poll, released by IBOPE on Tuesday evening, suggested that the percentage of voters intending to back far-right candidate Jair Bolsonaro had risen to 26%. Mr Haddad isn’t doing badly – his share has risen to 8% while other candidates saw their share remain stable or fall.
The Workers’ Party has adopted a new slogan – “Haddad is Lula” – there’s no clearer signal that although Lula is out of the race, the country’s most popular politician is still in the minds of millions.
Why was Lula barred?
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.
Why has he remained so popular?
While he was in office, from January 2003 to December 2010, Brazil experienced its longest period of economic growth in three decades, allowing his administration to spend lavishly on social programmes.
Tens of millions of people were lifted out of poverty thanks to the initiatives taken by his government and many of them remain loyal supporters.
Many poor Brazilians could also relate to Lula in a way that they could not relate to other Brazilian politicians.
A charismatic leader, he served two consecutive terms as Brazil’s president before helping his protégé, Dilma Rousseff, to be elected.
Who is Fernando Haddad?
He was the minister of education during Lula’s presidency and is thought to enjoy his trust. He was Lula’s vice-presidential running mate until now.
From 2013 to 2017, the 55-year-old also served as mayor of São Paulo, Brazil’s most populous city and faced mass demonstrations against bus fare rises.
The Workers’ Party hopes that Mr Haddad will get through to the run-off scheduled for 28 October.
But Mr Haddad is facing legal problems of his own. Prosecutors allege that during his campaign for mayor his team received a loan from a construction firm which stood to benefit from contracts once he was elected. He has denied any wrongdoing.