ANKARA (AFP) - Turkish Prime Minister Recep Tayyip Erdogan, who will be Turkey's next president after an easy election victory, climbed from a humble youth in Istanbul to become one of the most significant but controversial leaders in the Islamic world.
Mr Erdogan, who has served as premier since 2003, is lauded by his supporters as a transformative figure who modernised Turkey and delivered power back to the people from the secular and military elite.
But the 60-year-old is also an increasingly divisive figure, hated by large numbers of secular Turks who see him as an autocrat slowly but surely Islamising the country.
There is no doubt that Mr Erdogan has his eye on history and wants to be ranked alongside Turkey's post-Ottoman founding father Mustafa Kemal Ataturk as one of the great transformative figures in its modern history.
Mr Erdogan, a towering figure of almost 2m tall, is known to himself and followers as the "buyuk usta" - the "big master".
Should he serve two five-year terms as president, he will be ruling Turkey in 2023 when the country celebrates the 100th anniversary of its founding by Ataturk.
His aim is to transform Turkey into both a modern European state and Islamic power, with breathtakingly ambitious projects including a brand new high speed train network for the entire country, a tunnel beneath the Bosphorus and a new canal in Istanbul for ships.
A strongman image, economic growth and pride in Muslim identity have bought him the undinting support of huge swathes of the country, particularly in rural and poorer areas.
Yet for his foes, Mr Erdogan is a throwback to the autocratic excesses of the Ottoman empire who risks destroying Ataturk's secular legacy and the country's dream of one day joining the EU.
"It is going to be hard for him to bridge the divide," said Soner Cagaptay, director of the Turkish Research Programme at The Washington Institute.
The son of a coastguard officer in Istanbul's harbourside neighbourhood of Kasimpasa, Mr Erdogan spent his earliest years in the region of Rize by the Black Sea but returned to Istanbul by his early teens.
He took a degree in business administration and, a promising footballer, even played semi-professional football for an Istanbul club.
He joined Islamic youth groups that challenged the era's secular-nationalist regimes and the powerful military who ousted governments in coups in 1960, 1971, 1980 and 1997.
Under his mentor Necmettin Erbakan, who would later become prime minister, Mr Erdogan rose to prominence in the Islamic movement.
It was there he also met his wife Emine who has been a constant presence throughout his political career. They have two sons and two daughters.
Mr Erdogan became mayor of Istanbul in 1994, and set about tackling urban woes such as traffic gridlock and air pollution in the megacity of more than 15 million people.
When his religious party was outlawed, he joined demonstrations and was briefly jailed for four months for reciting an Islamist poem which the court regarded as incitement to religious hatred.
"The mosques are our barracks, the domes our helmets, the minarets our bayonets and the faithful our soldiers," read the controversial poem he recited - words he has repeated again and again.
In 2001 Mr Erdogan and his long time ally, the outgoing president Abdullah Gul, co-founded the Islamic-rooted Justice and Development Party (AKP), which scored a landslide win the following year and has easily won every election since.
Initially barred from becoming premier due to his criminal conviction, he rose to be head of government in 2003 when parliament passed new reforms.
Under his rule, Turkey showed stellar growth rates that were the envy of other emerging markets and adopted an increasingly confident position on the international stage.
He famously walked out of a World Economic Forum debate with the then Israeli president Shimon Peres in 2009, in a moment that symbolised Turkey's more assertive foreign policy stance.
But Mr Erdogan faced the worst crisis of his rule as prime minister over the past year, weathering massive anti-government protests, an explosive corruption scandal and a stuttering economy.
The protests in 2013 over plans to build a shopping mall on a Istanbul park provided a rallying cause for secular Turks and probably marked a low point of his rule.
Even as some voices within the ruling party urged moderation, Mr Erdogan came out fighting, famously slamming the protesters as "capulcu" ("hooligans").
The anger came to a head again over his response to the mine tragedy in the western town of Soma in May that claimed 301 lives, when he attempted to downplay the incident by comparing it to mining disasters in 19th-century Britain.
But Mr Erdogan simply became more pugnacious, battering his opponents in mass rallies where he shows off his rhetorical gifts in front of adoring crowds.
His number one enemy is the Pennsylvania-based cleric Fethullah Gulen, an estranged former ally who the premier accuses of creating a "parallel state" aimed at toppling his government.
Opponents have criticised moves to Islamise Turkish society: in recent years Mr Erdogan has eased restrictions on women wearing the veil, limited alcohol sales and made efforts to ban mixed-sex dorms at state universities.