Half of Brazilians want former President Luiz Inacio Lula da Silva to win next year's election and return to the office he occupied between 2003 and 2010. The other half wants him in prison for a corruption conviction.

Those dueling sentiments now underscore an important question as campaigns begin gearing up ahead of the 2018 election: Will da Silva, who is appealing the conviction, be allowed to run?

"Whether Lula runs or not makes all the difference in the next election," said Carlos Melo, a political science professor at Insper University in Sao Paulo. "Even if he is jailed he won't be out of the race, as whoever he supports could be a competitive candidate."

With a lead in all polls, the man universally known as Lula is campaigning across Brazil while he appeals the guilty verdict. If it's upheld, he could go to jail and be barred from running. If it's overturned, da Silva is facing several other trials that could interfere with his campaign.

Despite the setbacks, da Silva has seen his approval rating rise since the conviction, cementing the reality that he will likely be a force in the election one way or the other.

The chairman of a group of three magistrates has said that he expects the court to rule on da Silva's appeal before next August. The election is in October.

Da Silva was convicted in July by Judge Sergio Moro as part of a sprawling investigation into kickbacks by construction companies and public officials. Da Silva was sentenced to 9 1/2 years in jail and barred from holding public office for seven.

But while candidates figure out how to position themselves depending on da Silva's legal fate, there are also questions about whether the former president's own Workers' Party has a Plan B.

"Lula's candidacy is irreversible," Workers' Party chairwoman Gleisi Hoffmann told The Associated Press.

Ciro Gomes, a former Cabinet minister in da Silva's government and a presidential hopeful himself, disagrees.

"The Workers' Party will have a candidate, but it won't be Lula," Gomes said recently at a conference in Sao Paulo.

The election is Oct. 7, 2018, with a likely runoff three weeks later if none of the candidates obtain more than 50 percent of the vote.

A survey by polling firm Datafolha says Silva has 30 percent support for the first election round, compared to 20 percent for his closest rival, Congressman Jair Bolsonaro, a former army captain who speaks glowingly about the country's 1964-1985 dictatorship.

The poll also indicates da Silva would beat every adversary in a runoff, except for a tie with Moro, the judge who convicted him but who has repeatedly said he will not run despite being hailed by many Brazilians as a hero.

Meanwhile, 54 percent of the Brazilians surveyed said they want the former president in jail.

The poll was conducted Sept. 27-28 after da Silva's conviction in the "Car Wash" probe. Datafolha interviewed 2,772 people and said the poll had a margin of error of 2 percentage points.

Overall, the poll said da Silva has become more popular since he was found guilty. In July, Datafolha found that he was rejected by 46 percent of voters and would tie with former Cabinet minister Marina Silva in a runoff, compared to 42 percent of voters in October who said they would not back the ex-president.

Hoffmann believes President Michel Temer's dismal approval rating, which has hovered around 3 percent in recent polls, is a key reason why da Silva is gaining strength.

"People look at Temer and think of all the good things Lula did in office. The difference is staggering. And people have noticed how politicized the investigations against him are," she said.

Another factor fueling da Silva's lead is division among opponents who have not coalesced around an "anti-Lula" candidate.

The right-leaning Brazilian Social Democracy Party is torn between two possible candidates: Sao Paulo Gov. Geraldo Alckmin, who lost to da Silva in the 2006 presidential election, and Sao Paulo Mayor Joao Doria. So far, both are polling at less than 10 percent.

Da Silva has been holding large rallies across the country. He contends all the charges against him are politically motivated and promises better economic times, a message that resonates with many as Brazil struggles to emerge from its worst recession in decades.

At any moment, however, the higher court decision on his appeal could throw his campaign into a tailspin.

Fernando Castelo Branco, law professor at Sao Paulo's PUC University, said da Silva's candidacy will be revoked if the conviction is upheld before official campaigning begins in August.

"If he has already registered his candidacy, the court could still uphold the conviction or add to his penalties and in that case his candidacy could be annulled," Branco said.