His victory over the AK Party (AKP) in the municipal vote dealt Erdogan one of the worst setbacks in his 16 years of power. But Imamoglu had been in office less than three weeks when Turkey's High Election Board annulled the results, citing irregularities, after weeks of appeals by the AKP.

Today - after having pulled off victory in March to become Istanbul mayor, only to be ousted in May - he has emerged as a national sensation and figurehead for the Turkish opposition.

Three months ago Ekrem Imamoglu was a little-known politician in a fringe Istanbul district who was attempting the near-impossible: to unseat Turkish President Tayyip Erdogan's ruling AK Party from Turkey's largest city after 25 years in power.

Turkey's President Recep Tayyip Erdogan makes a speech during his party's parliamentary group meeting at the Grand National Assembly of Turkey in Ankara on January 8, 2019.

Now the 49-year-old is trying to win again in a re-run of the mayoral vote on Sunday, this time against an AKP machine that has zeroed in on him with accusations of lying and terrorist associations as well as legal threats.

Imamoglu has denied the allegations from Erdogan, Turkey's foreign minister and his AKP mayoral opponent Binali Yildirim, a former prime minister.

In response the former businessman has tried to stick to the low-key inclusive message that handed him a narrow victory in the first campaign. There are indications the scrapping of the election results, which many voters say was unjust, has actually served to bolster his popular support.

Recent polls give Imamoglu of the secularist Republican People's Party (CHP) a lead of as much as nine percentage points over Yildirim of the Islamist-rooted AKP, far larger than his 0.2 percentage-point victory on March 31.

With his signature rimless eyeglasses and "Everything will be fine" slogan on billboards across Istanbul, Imamoglu has sought to leverage the election board's decision to annul the results over irregularities including polling officials who were not civil servants.

"Of course we have a different agenda item in this election and that is democracy (for which) we are at a turning point," he told Reuters this week. "Our emphasis on the injustice and lawless intervention ... will continue until the last minute."

BIG RALLIES

On Thursday Erdogan, who served as Istanbul's mayor in the 1990s, accused Imamoglu of cheating in a televised debate by seeing the questions ahead of time, without citing evidence.

The Turkish leader has accused Imamoglu of being in cahoots with U.S.-based cleric Fethullah Gulen, whom Ankara says is a terrorist and blames for a 2016 failed putsch. He also said Imamoglu allegedly insulted the governor of Ordu, a Black Sea coastal province, and added that if prosecuted over the issue, he could be barred from office even if he wins.

The annullment of Imamoglu's victory, and attacks on his character, have however had the effect of raising his profile at home and abroad.

His rallies this month before thousands of CHP supporters, including on a three-city tour of Turkey's Black Sea coast, are a far cry from the small face-to-face gatherings and Facebook videos favoured in his initial campaign.

"Do you know what a political party opting to hurl constant insults and slander at its opponent shows? It shows that they know they have lost," he told a rally on Wednesday.

Some media commentators have even earmarked him as a potential presidential candidate.

"There's this expectation that he is likely to be the face of the opposition," said Deniz Zeyrek, a journalist at opposition newspaper Sozcu. "I believe he will be in Turkey's political future, even if he loses."

Imamoglu has also been the subject of feature articles in Western magazines and newspapers. This month he authored a column in the Washington Post, pledging to win again.

"I see little reason why Imamoglu would lose votes on June 23," said Howard Eissenstat, nonresident senior fellow at Washington-based think-tank the Project on Middle East Democracy.

But he added that Imamoglu would want to win with a bigger margin to earn a definitive victory and put an end to any potential claims of irregularities.

However some academics warn that Imamoglu could overplay his hand.

"His challenge is to use the cult of victimhood but still be defiant," said Galip Dalay, visiting scholar at the University of Oxford's Department of Politics and International Relations.

"Too many big things - rallies, comments on national issues - that could backfire."