It would be hard to overstate the prominence of former president Luiz Inácio Lula da Silva in Brazil. The founder of the left-wing Workers’ Party, this former union leader – who goes by “Lula” – has dominated Brazilian politics for the last 30 years.

Lula was a top contender in the 1989, 1994 and 1998 elections. He won the presidency in 2002 and was re-elected by a landslide in 2006. Leaving office with an 80% approval rating, he helped get his protege Dilma Rousseff elected to succeed him in both 2010 and 2014.

Now Lula is a clear favourite for Brazil’s October 2018 presidential election. There’s just one problem: He’s in jail.

On July 21, a Brazilian appeals court sentenced the former president to 12 years in prison for corruption – a polarising and controversial verdict Lula supporters see as a politically motivated attempt to derail his campaign.

In theory, Lula can still run. Brazil’s “Clean Slate” statute forbids candidates with criminal convictions upheld on appeal to run for office, but conflicting legal interpretations leave some room for doubt. The Superior Electoral Court has not yet vetoed his candidacy.

As Brazilian political scientists, however, we believe Lula’s chances of actually competing in October are slim. With 12 candidates and no front-runner, this is Brazil’s most unpredictable election since it transitioned from dictatorship to democracy in the 1980s.

What happens next?

Brazil has a high number of political parties – 35 at last count. Even so, presidential elections here have traditionally been rather predictable.

The two-round election counterbalances the centrifugal forces of the country’s multiparty system, allowing parties to regroup around the two leading candidates for the run-off. In the last six presidential elections, the two biggest parties – Lula’s Workers’ Party and the conservative Social Democratic Party of Brazil – have ultimately faced off.

With October’s election approaching quickly, the Workers’ Party faces a serious dilemma.

Party leaders could continue to back Lula’s candidacy as long as the electoral court allows it. If he is ultimately disqualified, they could then ask his base to shift their support to a replacement candidate.

Polls show that two out of three Lula supporters would vote for whoever he endorses. But if Lula is disqualified late in the campaign, Workers’ Party voters would have little time to get to know whomever is tapped to replace him.

Alternatively, the party could decide that Lula’s candidacy is a lost cause and ask the former president to endorse another candidate now. We believe that is improbable, though, since Workers’ Party leaders would be leery of showing their base a sign of weakness.

The strongest candidate with any chance of appealing to Lula voters is Ciro Gomes, of the centrist Democratic Labor Party. But Gomes, a maverick, seems determined to distance himself from the Workers’ Party and its towering founder.

Brazil’s unpredictable race

The Workers’ Party isn’t alone in struggling this campaign season.

President Michel Temer, who rose to power after Dilma Rousseff’s 2015 impeachment and has also been charged with corruption, is extremely unpopular. Almost half of the population saw Rousseff’s impeachment as a coup d’etat orchestrated by him. Temer’s painful austerity measures, pushed through during a deep recession, alienated pretty much everyone else.

With an approval rating in the single digits, the president will likely not run for re-election.

Former São Paulo governor Geraldo Ackmin, who is representing Brazil’s mainstream conservative Brazilian Social Democratic Party, is languishing, too. He scored just 8% in the latest poll. Ackmin and other key party figures are enmeshed in the same nationwide corruption scandal that took down Lula, though none have been convicted or arrested.

Even the Brazilian media, which typically throws its weight behind the leading candidate, is scrambling this election season.

Earlier this year, most newspapers seemed to settle on a popular talk show host, Luciano Huck, who was eyeing a presidential bid. But in early February he dropped out of the race.

Then columnists began praising former Supreme Court Justice Joaquim Barbosa. He became something of a media star a few years back when he convicted several Workers’ Party officials in a high-profile corruption case.

But in early May, Barbosa, too, withdrew his bid.

A reminder of the dictatorship

If any candidate really stands out from the crowd, it is Congressman Jair Bolsonaro, a staunchly pro-gun, anti-abortion former military commander. But the media seems to view him as too outrageous to rally behind.

In April, Bolsonaro was charged with “inciting hatred” for his verbal attacks on women, gay people and minorities. He often speaks with nostalgia of the military dictatorship that governed Brazil from 1964 to 1985.

The Economist has dubbed Bolsonaro “Brazil’s Donald Trump.”

Bolsonaro, a former general who invokes Brazil’s military dictatorship with nostalgia, is in second place in the country’s presidential race. Reuters/Rodolfo Buhrer

Throughout the campaign, Bolsonaro has trailed only Lula. Roughly 15% of Brazilians say they plan to vote for him.

Lula’s exit should give him a boost. But Bolsonaro’s greatest weakness is his extremism. In a two-round electoral process like Brazil’s, as history shows, the candidate who captures the middle wins.

Enter the outsider?

In an election year when both mainstream parties are battling corruption allegations, some candidates are conspiring to paint themselves as outsiders.

Marina Silva, an evangelical environmentalist now in her third presidential bid, has long presented herself as a political outsider who could bring change to Brazil. Even Bolsonaro, who has served in Congress for 30 years, touts his credentials as a military man.

That’s a reasonable electoral strategy this year. But since neither Silva nor Bolsonaro is backed by a mainstream political party, they will lack the funding, TV and radio ad time and campaign infrastructure to reach all Brazil, the world’s fifth-largest country.

After four years of protracted political crisis, many hope the 2018 election – when Brazilians will choose not just their president but also congressional representatives and governors – will give Brazilian democracy a much-needed restart.

But, given the circumstances, that seems like a long shot.

João Feres Júnior, Professor of political science, Rio de Janeiro State University and Fabio Kerche, Political science researcher, Fundação Casa de Rui Barbosa

This article first appeared on The Conversation.