Traders who were bidding up the Brazilian real and local stocks on Friday on the expectation that Lula would be barred from running for president in Brazil's upcoming presidential elections proved to be right: late on Friday, Brazil’s top electoral court banned jailed former president Luiz Inacio Lula da Silva from running in this year’s presidential because of his prior corruption conviction.

In the 6-1 ruling, the country’s top electoral court decided that Lula’s candidacy cannot stand, given his 12-year sentence for corruption and money-laundering by an appeals court earlier this year Bloomberg reported.

The ruling came after a dramatic and gruelling late-night session broadcast live on television and across news sites, and defied a request from the United Nations human rights committee that he be allowed to stand.

"I declare the candidate ineligible and I deny his application to run for the presidency," said Luis Roberto Barroso, the lead judge reading out a summary of the ruling at the court. "I veto electoral propaganda until the candidate’s name is replaced on the ballot."

“What is at stake here today is the equality of all citizens before the law and the Constitution,” Judge Og Fernandes told the court in his vote to declare Lula ineligible. Judge Admar Gonzaga, who as a lawyer worked for Lula’s handpicked successor Dilma Rousseff’s 2010 election, cast the decisive vote in the 6-1 decision that sealed the leftist icon’s ejection from the presidential election.

From behind bars, Lula, the hugely popular, two times former leftist president and union leader leads polling in Brazil’s most unpredictable and polarised presidential election in decades. The decision to bar his candidacy plays to the advantage of extreme rightwing candidate Jair Bolsonaro, running second in polls and ahead without Lula.

The widely expected decision removes a cloud hanging over Brazil’s most uncertain election in decades, in which polls gave Lula - widely seen as a "market unfriendly" - a huge lead over his challengers, though Lula’s lawyers and the Workers Party have said they would appeal an adverse decision to the Supreme Court.

Lula, who had a 20 point lead ahead of his closest competitor, far-right candidate Jair Bolsonaro, and is the most influential political figure in Brazil’s recent history, has been in jail since April after an appeals court confirmed a 12 year sentence for corruption and money laundering. His Workers Party registered him as its presidential candidate for the Oct. 7 vote anyway, saying he is innocent.

Despite his conviction and several graft cases pending against him, Lula leads the presidential race by a long stretch, with 39% of voter support, according to pollster Datafolha. His nearest rival, Bolsonaro, has 19%.

However, barring an extraordinary upset through appeal, it looks all but certain that the iconic former metalworker won’t run on Oct. 7 and will be replaced by his running mate, former Sao Paulo mayor Fernando Haddad, who is expected to head the ticket hoping to inherit the bulk of Lula’s votes.

The Workers Party has until Sept. 17 to swap their names on the ballot; The court also ruled that Lula should not appear in the Workers Party’s television and radio ads campaign until the ticket has been officially altered to remove him.

The question now, according to Bloomberg, is how much of his huge support Lula can transfer to Haddad from his prison cell. Opinion polls suggest it could be enough to push his protege, a 55 year-old academic into a runoff with the front-runner, former Army Captain Jair Bolsonaro.

Campaign ads that circulated on social media in recent days showed images of Lula before he was jailed, and of Haddad, both promising better days for Brazil. Free radio and TV air time allotted to presidential candidates begins on Saturday

That said, investors remain concerned about the possible return of the same left wing party that oversaw the worst recession on record, and whose president Dilma Rousseff was impeached in 2016. The leftist party proposes to ramp up government intervention by taxing banks who charge high interest rates and introducing capital controls to reduce volatility.

With the chances for market-friendly candidates increasingly gloomy, investors have dumped Brazilian assets, exacerbating the impact of an emerging market selloff. The real has lost 19% in 2018 making it one of the worst performing currencies after the Argentine Peso and Turkish Lira.

A left-wing victory that would boost social spending would be seen as a disaster for markets: as Bloomberg warns, if the next president doesn’t adopt draconian austerity measures, including far-reaching cuts to pension benefits, government spending would break through constitutionally imposed limits, putting at risk the creditworthiness of $950 billion in federal government debt."

Of course, the reason why Lula remains so popular in the first place, is that the local population fondly remembers the Brazilian growth phase in the early part of the century under the former two-time leftist president - if not the painful depression that followed - and equates the current period of economic pain with precisely the economic policies that Brazil will need to implement in the coming months to avoid an even bigger economic meltdown.