AKP and ruffled feathers when he went on the campaign trail in June.
He was initially hailed in the West for creating a model Muslim democracy on Europe’s eastern edge and Turkey had hoped to play a key mediator role on the global stage.
But Ankara lost friends after the Arab Spring and relations cooled with the West, particularly over its support for Islamic rebels in the Syrian conflict and for a worsening rights record, which hampered its EU aspirations.
Erdogan is known to himself and followers as the “buyuk usta” — the “big master” — or simply “the Sultan”.
There is no doubt Erdogan has his eye on his legacy and wants to go down in history alongside modern Turkey’s founding father Mustafa Kemal Ataturk as one of its great leaders.
He has launched breathtakingly ambitious projects including a new high-speed rail network and a tunnel beneath the Bosphorus.
The son of a coastguard officer, he was born in Istanbul’s harbourside neighbourhood of Kasimpasa and 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 once played semi-professional football for an Istanbul club.
Rising to prominence in the Islamist movement, he became Mayor of Istanbul in 1994, tackling urban woes such as traffic gridlock and air pollution in the mega city of 15 million.
When his religious party was outlawed, he joined demonstrations and was jailed for four months for inciting religious hatred when he recited an Islamist poem.
In 2001 Erdogan, along with long-time ally Abdullah Gul and others, founded the Islamic-rooted AKP, which has won every election since 2002. “The AKP is my fifth child,” says Erdogan, who has two sons and two daughters.
Initially barred due to his criminal conviction, he became premier in 2003 when parliament passed new reforms.
Under his rule, Turkey showed stellar economic growth rates that were the envy of other emerging markets and adopted an increasingly confident position on the international stage.
But from 2013, Erdogan started to encounter challenges to his rule and he reacted in a combative fashion.
His government cracked down on protests over plans to redevelop an Istanbul park that snowballed into nationwide demonstrations against his rule and left eight people dead. He branded the protesters “capulcu” (hooligans).
Anger came to a head again over his response to a mine tragedy last year that claimed 301 lives, when he attempted to downplay the incident by comparing it to mining disasters in 19th-century Britain.
And since he became Turkey’s first directly elected president in August 2014, he has become even more pugnacious and some say “Putinised”.“The last dictator!” said one placard brandished by demonstrators protesting at the television raid this week.