Turkey's President Recep Tayyip Erdogan, currently facing down an attempted military coup, is the most divisive leader in the history of the modern republic.
Adored by his supporters as a transformative figure who modernised Turkey, his foes have painted him as an increasingly despotic leader who ruthlessly shuts down any criticism.
Turkey has suffered a wave of deadly bombings as Erdogan's government pursues twin military campaigns against Kurdish rebels in the south and the Islamic State group in neighbouring Syria.
And his ruling Justice and Development Party (AKP) has long been accused of seeking to impose conservative Islamic values on society — a possible point of friction with a military that has long seen itself as the guardian of Turkey's secular state.
Rising from premier to become the nation's first directly-elected president in 2014, Erdogan has dreamed of boosting his hold even further by changing the constitution to give Turkey a US-style executive presidency.
But the dramatic events of Friday night have shaken his grip on power in a way few could have imagined even a day earlier.
'The big master'
With a notoriously fiery temper, Erdogan is known to himself and followers as the "buyuk usta" — the "big master" — or simply "the Sultan".
The 61-year-old first came to power as prime minister in 2003, bringing stability after a history of coups and rocky coalitions and dragging the Muslim-majority country out of an economic quagmire.
He succeeded in clipping the wings of the military by purging elements that opposed him — or so he claimed.
But ordinary Turks became suspicious of moves to "Islamicise" society by restricting alcohol sales, curbing the Internet and even trying to ban mixed-sex dorms at state universities.
Pushing for Turkey to become a top-ten economy by the republic's 100th anniversary in 2023, he launched a series of breathtakingly ambitious infrastructure projects, including a high-speed rail network and a tunnel beneath the Bosphorus.
But his vast new $615 million presidential palace with 1,150 rooms has been ridiculed as an absurd, tasteless extravagance — and a symbol of his creeping authoritarianism.
That authoritarianism has seen critics muzzled, with a string of journalists as well as ordinary citizens ending up in court for insulting or slandering him.
The crackdown has earned fierce international criticism for a man initially hailed in the West for creating a model Muslim democracy on Europe's eastern edge.
But in recent months the AKP government has suffered a string of diplomatic crises — making a previous foreign policy known as "zero problems with neighbours" seem almost laughable.
He faced a previous challenge to his rule in 2013 when protests over plans to redevelop Istanbul's Gezi park snowballed into the mass anti-government demonstrations.
He is also known for making sometimes bizarre statements, such as declaring Muslims discovered the Americas before Columbus, that women are not equal to men and even boasting "We will wipe out Twitter".
Erdogan has now spent more than a decade at the top as the most powerful Turkish politician since founding father Ataturk, but his beginnings were humble.
The son of a coastguard officer, he is deeply proud of his roots in a working-class Istanbul suburb.
He has 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 megacity 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 had won every election since 2002 until June last year when it lost its majority for the first time.
The party bounced back in a second vote in November, boosting Erdogan's hopes once more to consolidate his power.
"The AKP is my fifth child," says Erdogan, who has two sons and two daughters.
Find latest and upcoming tech gadgets online on Tech2 Gadgets. Get technology news, gadgets reviews & ratings. Popular gadgets including laptop, tablet and mobile specifications, features, prices, comparison.
Updated Date: Jul 16, 2016 09:42:26 IST