CURITIBA/RECIFE (Reuters) - It is Thursday outside a government building in this tidy city in southern Brazil. Luiz Inacio Lula da Silva, the country’s former president, is receiving visitors to plot his political future.

Never mind that this compound, the regional federal police headquarters, doubles as a prison for corrupt politicians. Or that Lula, as this leftist icon is universally known, is serving a 12-year sentence for graft.

Despite his predicament, Lula is still calling the shots in his Workers Party (PT) and engineering another presidential run, underscoring his stature as the most popular modern political figure in Brazil. During his two presidential terms, which ran from 2003 to 2011, the economy soared, poverty plunged and Brazil basked in the international spotlight, winning bids to host the 2014 World Cup and the 2016 Olympic Games.

PT lieutenants regularly visit Lula in prison to map out strategy ahead of October’s presidential balloting, eight party insiders told Reuters. This day’s crop included Vagner Freitas, head of Brazil’s most powerful trade union. Lula’s vice presidential running mate Fernando Haddad, and Gleisi Hoffmann, the PT’s president, showed up the following day.

Outside the lock-up, vendors sold T-shirts with Lula’s bearded visage to the partisan crowd. Occasional chants of “Lula president, Lula innocent” filled the air.

His candidacy is the longest of long shots. Convicted felons are banned from running for office. An electoral court is expected in coming weeks to declare him ineligible for October’s race.

Critics decry Lula’s bid as a stunt aimed at motivating the base and propping up Haddad, his likely stand-in. The former mayor of Sao Paulo, Haddad is little-known outside that city - and disliked by many in it.

But in a chaotic political season in Brazil, Lula could be the kingmaker. The presidential contest is unpredictable, loaded with candidates struggling to connect with voters. Brazilians are despondent over their nation’s stagnant economy, rampant violence and ineffective political class.

The PT is betting Lula’s star power can remind voters of more prosperous times when he ran the show. At 72, the charismatic former metal worker still dominates the party he founded and shows no signs of letting prison constrain him.

“There is no question that Lula is a key political actor,” said Ricardo Ismael, a political scientist at the Catholic University in Rio de Janeiro. “Lula will have tremendous influence even if he is not a candidate. He has prestige and is a political force, mainly with the poorer voters.”

In handwritten letters and conversations relayed by visitors tasked with carrying out his orders, the former president has quelled infighting that had threatened his leadership, both inside the PT and in a coalition of allied parties, several senior party members who have met with Lula in jail told Reuters.

Slideshow ( 25 images )

They say he effectively knee-capped a political rival with designs on his mantle, and arranged for his surrogate Haddad to take his place atop the PT ticket should he be barred from running.

Federal prosecutors are fed up with Lula’s maneuvering.

The team whose investigation put him in jail has asked a judge to restrict his jailhouse visitors. In a sealed court document dated June 28 and obtained by Reuters, they said Lula has transformed his cell “into his campaign headquarters.” They want to limit the list to family, clergy and lawyers working specifically on his legal defense.

The judge has yet to make a decision.

Meanwhile, polls show Lula leads a pack of 13 candidates in a potential first-round matchup; the top two vote-getters advance to a run-off if no one wins a majority.

Still, plenty of Brazilians despise the former president, whose big-spending policies and scandals they blame for plunging Brazil into a tailspin. Others are eager to move on to fresh leadership. Some fear his meddling could ultimately deliver the presidency to the race’s most extreme candidate, Jair Bolsonaro, a far-right ex-military man who has cheered Brazil’s former dictatorship and delights in sullying Lula’s legacy.

Brazil's imprisoned Lula leads pre-election polls - tmsnrt.rs/2NeuHiy

SERENADES, SUNBATHS, SOLITUDE

Until Lula arrived, Curitiba was best-known as the base of Judge Sergio Moro, who is overseeing a sweeping corruption probe known as Operation Car Wash.

That ongoing investigation revealed a massive bribes-for-public works scheme that ensnared Lula along with scores of business leaders and politicians from all major parties. Lula was convicted last year for accepting renovations to a luxury beach apartment from a construction firm in exchange for helping it win contracts with state-run oil company Petroleo Brasileiro SA or Petrobras. He faces five additional corruption trials. He maintains his innocence.

Slideshow ( 25 images )

Since Lula was jailed on April 7, the area around Curitiba’s federal police headquarters has morphed into the epicenter of leftist resistance. Supporters have proclaimed Lula a political prisoner. They allege right-wing enemies conspired to drive the PT from power by jailing him and impeaching his hand-picked successor, former President Dilma Rousseff. She was tossed from office in 2016 for fudging government accounts, which she denies.

Now unions, the Landless Workers Movement and private citizens have rented a few houses in Curitiba to stay while keeping vigil.

Among the roughly 150 supporters who assemble daily outside the jail is Adinaldo Aparecido Batista, an unemployed construction worker. He recounted the abundant jobs, anti-poverty programs and consumer credit that flourished under Lula.

“I was able to buy three cars and even a little inn,” said Batista, 52. “Now, I have almost nothing.”

These faithful gather every morning to chant “good morning, President Lula!” After night falls, they call in unison to bid him sweet dreams. On weekends, musicians belt out ballads to raise his spirits.

Lula occupies a 160-square-foot room at the federal police building that once housed visiting officers. A handful of other politicians and businessmen are incarcerated in formal, shared cells. Lula is not allowed to mix with other prisoners.

Those familiar with his routine spoke on condition of anonymity because they are not authorized to speak publicly. They said Lula is allowed to wear his own clothing, often a soccer jersey, and can spend up to two hours daily in an open courtyard. His room contains a TV and a treadmill where he logs four miles daily. He has access to books and devotes hours to writing.

Still, the gregarious Lula lives for his visitors, the people said. Clergy come on Mondays. Thursdays are for family and friends.

But the real access belongs to Lula’s legal team, whose members can come at any time and stay as long as they like, without supervision or electronic eavesdropping from jailers. The PT’s Haddad and Hoffmann, both lawyers, are on that team, enabling them to carry out Lula’s directives and spread his message.

Among the most visible moves, people familiar with the situation say, was Lula’s order to undercut the presidential chances of Ciro Gomes of the center-left Democratic Labor Party (PDT). Gomes appeals to some Brazilian progressives and could siphon votes from Lula or Haddad.

So the PT struck a deal with another leftist party. The Brazilian Socialist Party (PSB) agreed to withhold support from Gomes and remain neutral in the presidential contest, the people said. In exchange, the PT agreed to back a PSB candidate in a gubernatorial contest.

Gomes, who has yet to catch fire in the polls, is steaming at what he sees as betrayal. Long an ally of Lula and the PT, Gomes said in a TV interview that he has been repaid with “disrespect and hostility.”

The PT acknowledges playing hardball.

“The number one priority was Lula’s candidacy,” a PT spokesman said.

Such bare-knuckle tactics have not dissuaded true believers like retired teacher Gliceria Polak. She was among those chanting to Lula on a recent morning in Curitiba.

“If he has to serve out his 12-year sentence here, I will never leave this place,” she said. “Under no circumstances will I abandon Lula.”