Recep Tayyip Erdogan: Turkey's dominant president
Not since the days of Mustafa Kemal Ataturk, the father of the modern Turkish Republic, has any figure dominated the country for as long Recep Tayyip Erdogan.
The president's grip on power was seriously challenged by an attempted coup on 15 July. Yet he was back less than 12 hours later, some say in an even stronger position than before. And he had out-manoeuvred the plotters.
To his supporters he has brought Turkey years of economic growth, but to his critics he is an autocratic leader intolerant of dissent who harshly silences anyone who opposes him.
And dissenters range from a 16-year-old arrested for insulting the president to a former Miss Turkey who got into trouble for sharing a poem critical of the Turkish president.
The failed coup claimed at least 240 lives and, according to his officials, also came close to killing Mr Erdogan, who had been staying at the Aegean holiday resort of Marmaris.
Within hours, he appeared on national TV and rallied supporters in Istanbul, declaring he was the "chief commander". But the strain on the president was clear, when he sobbed openly while giving a speech at the funeral of a close friend, shot with his son by soldiers during the attempted coup.
Mr Erdogan, 62, came to power in 2002, a year after the formation of the AK Party (AKP). He spent 11 years as Turkey's prime minister before becoming the country's first directly-elected president in August 2014 - a supposedly ceremonial role.
He is known to harbour ambitions of creating an executive presidency, to regain some of the powers he relinquished when his tenure as prime minister ended in 2014.
While the AKP enjoys a fierce and loyal support among Turkey's conservative, Muslim base, his silencing of critics has caused alarm abroad.
Turkish journalists have been investigated and put on trial, foreign journalists have been harassed and deported.
And Mr Erdogan's authoritarian approach is not confined to Turkey's borders. His bodyguards harassed reporters in the US, and a German satirist is under investigation in his home country for offending the Turkish president on TV.
In June 2015 the AKP suffered a dip in the polls and failed to form a coalition.
But the party swept back to power in November with 49% of the vote, in elections overshadowed by the end of a ceasefire with the Kurdish militant PKK.
Erdogan's rise to power
Born in 1954, Recep Tayyip Erdogan grew up the son of a coastguard, on Turkey's Black Sea coast.
When he was 13, his father decided to move to Istanbul, hoping to give his five children a better upbringing.
As a teenager, the young Erdogan sold lemonade and sesame buns on the streets of Istanbul's rougher districts to earn extra cash.
He attended an Islamic school before obtaining a degree in management from Istanbul's Marmara University - and playing professional football.
1970s-1980s - Active in Islamist circles, member of Necmettin Erbakan's Welfare Party
1994-1998 - Mayor of Istanbul, until military officers made power grab
1998 - Welfare Party banned, Erdogan jailed for four months for inciting religious hatred
Aug 2001 - Founds Islamist-rooted AKP (Justice and Development Party) with ally Abdullah Gul
2002-2003 - AKP wins solid majority in parliamentary election, Erdogan appointed prime minister
Aug 2014 - Becomes president after first-ever direct elections for head of state
July 2016 - Survives attempted coup by factions within the military
Challenging the military
In the decades before the AKP's rise to power, the military intervened in politics four times to curb Islamist influence.
And Recep Tayyip Erdogan has for years embraced Islamist-rooted politics. When he became mayor of Istanbul in 1994 he stood as candidate for the pro-Islamist Welfare Party.
He went to jail for four months in 1999 for religious incitement after he publicly read a nationalist poem including the lines: "The mosques are our barracks, the domes our helmets, the minarets our bayonets and the faithful our soldiers."
When he became prime minister in 2002 as head of the AKP, he asserted civilian supremacy over the army.
In 2013 he triumphed over the military elite when senior officers were among a large group of people convicted of plotting to overthrow him in what was known as the "Ergenekon" case. Those convictions were later quashed.
Critics have accused Mr Erdogan of using the judiciary to silence political opponents, and there have been many allegations of trumped-up charges.
But his supporters applauded him for taking on previously untouchable establishment figures, who saw themselves as guardians of the state created by Ataturk.
Gezi Park protests
Mr Erdogan also unleashed the power of the state to crush mass protests in Istanbul in June 2013, focused on Gezi Park, a green area earmarked for a huge building project.
The protests spread to other cities, swelled by many secularist Turks suspicious of the AKP's Islamist leanings.
A major corruption scandal battered his government in December 2013, involving numerous arrests, including the sons of three cabinet ministers.
Mr Erdogan raged against "plotters" based outside Turkey, condemning supporters of cleric Fethullah Gulen, a former ally turned rival in self-imposed exile in the US. He also lashed out against social media, vowing to "wipe out" Twitter.
Mr Erdogan has denied wanting to impose Islamic values, saying he is committed to secularism. But he supports Turks' right to express their religious beliefs more openly.
That message goes down particularly well in rural and small-town Anatolia - the AKP's traditional heartland. Some supporters nicknamed him "Sultan" - harking back to the Ottoman Empire.
In October 2013 Turkey lifted rules banning women from wearing headscarves in the country's state institutions - with the exception of the judiciary, military and police - ending a decades-old restriction.
Critics also pointed to Mr Erdogan's failed bid to criminalise adultery, and his attempts to introduce "alcohol-free zones", as evidence of his alleged Islamist intentions.
Mr Erdogan's political opponents saw a lavish new presidential palace as a symbol of his alleged authoritarian tendencies.
Perched on a hill on the outskirts of Ankara, the 1,000-room Ak Saray (White Palace) is bigger than the White House or the Kremlin and ended up costing even more than the original £385m ($615m) price tag.
Mr Erdogan owes much of his political success in the past decade to economic stability, with an average annual growth rate of 4.5%.
Turkey has developed into a manufacturing and export powerhouse. The AKP government kept inflation under control - no mean feat, as there were years in the 1990s when it soared above 100%.
But in 2014 the economy began flagging - growth fell to 2.9% and unemployment rose above 10%.
On the international stage he has bitterly condemned Israel - previously a strong ally of Turkey - over its treatment of the Palestinians. Although there is now a rapprochement, the policy not only galvanised his Islamic base, but also made him a hugely popular leader across the Middle East.
He has backed Syria's opposition in its fight against Bashar al-Assad's government in Damascus.
But his tentative peace overtures to the Kurds in south-eastern Turkey soured when he refused to help Syrian Kurds battling Islamic State militants just across the border.