War, corruption scandals, a spell in prison -- the career of veteran Slovenian centre-right leader Janez Jansa, leading in Sunday's election, has truly seen it all.
And now, with nearly all the votes counted, his SDS party looks to have won just over 25 percent of the vote, putting him in a strong position to seek a third stint as prime minister.
But first Jansa, 59, will have to find coalition partners -- no easy task as so many of Slovenia's other parties have said they won't work with him.
His close alliance to Hungary's authoritarian prime minister and his aping of Viktor Orban's anti-immigration rhetoric stirred controversy over the course of the campaign.
"Thanks to its (migration) policy, Hungary is a safe country, while Belgium, due to its wrong policy, isn't," read a recent Jansa tweet.
Despite condemnation from other parties his campaign proved effective, particularly the way in which Jansa stirred memories of the migration crisis in Europe in late 2015 and early 2016.
And Jansa benefited from the infighting among the parties in the outgoing coalition, according to analyst Janez Markes.
"(Jansa) didn't need to do anything. Just stand there, laugh quietly and stay calm, and put his basket out to collect the votes of those fighting among themselves," Markes said in the Delo newspaper.
- 'Prince of Darkness' -
Jansa's staying power, coupled with his abrasive personality, once led former President Danilo Turk to dub him Slovenia's "Prince of Darkness".
Like his close ally Orban, Jansa's career stretches back to the pro-democracy movements that brought about the collapse of communism.
He wasn't even 30 when he first came to prominence as one of four dissidents prosecuted for their criticism of Yugoslavia's Serb-dominated army. They were eventually freed after huge demonstrations.
Named defence minister in Slovenia's first democratically-elected government in 1990, he oversaw a guerrilla strategy which ended in the retreat of Yugoslav troops in the Ten-Day War for independence.
Forced to resign in 1994, he staged the first of many comebacks in 2004, winning his first term as prime minister just after Slovenia joined the European Union and overseeing entry to the eurozone in 2007.
- Campaigning from jail -
However, on the eve of the 2008 elections he was implicated in a bribery scandal connected to a 278 million euro ($324 million) deal with Finnish company Patria -- Slovenia's biggest defence deal ever -- and a spell in opposition beckoned.
But neither the scandal nor the fact that he came second in elections in late 2011 stopped him from embarking on a second term as prime minister a few months later.
In 2013, only a year into his second term, he was forced out by another corruption scandal and subsequently given a two-year jail sentence for a bribery conviction relating to the Patria case.
He ploughed on regardless, contesting parliamentary elections in 2014 from his cell in Dob prison near Ljubljana.
The bribery conviction was later overturned by the Constitutional Court -- it ordered a retrial, but that couldn't take place as too much time had elapsed.
Not content with his freedom, Jansa then demanded 900,000 euros ($1.04 million) in compensation from the state for having lost the 2014 elections - the case is ongoing.
Now he stands on the brink of yet another comeback, reinventing himself once again as part of Europe's growing anti-migrant populist movement.
Janez Jansa (R)and his wife Urska Bacovnik leave a polling station after voting in the small village Sentilj, as the veteran leader on top in the results appears ready to make yet another comeback