Recep Tayyip Erdogan: Turkey's pugnacious president
From humble beginnings Recep Tayyip Erdogan has grown into a political giant, reshaping Turkey more than any leader since Mustafa Kemal Ataturk, the revered father of the modern republic.
The referendum "Yes" vote gives him the green light to create a muscular presidency, with powers to personally appoint or dismiss ministers, select judges and rule by decree if he deems it necessary.
"For the first time in the history of the republic, we are changing our ruling system through civil politics," he told flag-waving supporters on 16 April.
It was a veiled reminder of the 15 July coup attempt, when his grip on power was seriously challenged by military officers.
An all-powerful presidency, he argues, is a guarantee that the political instability that used to plague Turkey will not return.
In 1960 and three more times in later decades the Turkish army intervened in politics, seeing itself as the guarantor of Ataturk's secular republic.
Its shadowy nationalist influence behind the scenes came to be known as "the deep state".
President Erdogan's powerful AK Party (AKP), rooted in conservative Islam, has shown a fierce determination to clip the military's wings. AKP stands for Justice and Development Party.
During his tenure Turkish courts have jailed dozens of officers for alleged coup plots, and the ranks have been purged since the attempt to topple him last year.
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.
Yet he was back in less than 12 hours, having outmanoeuvred the plotters.
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 mutinous soldiers.
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 voting pattern in the 16 April constitutional referendum shows a deeply polarised country. Mr Erdogan's Yes camp got 51.4% - a narrower margin of victory than he would have liked.
As expected, he won in the Anatolian heartland and Black Sea region. But the No camp won in the big cities - Ankara, Istanbul and Izmir - as well as on the Mediterranean coast and in the Kurdish-majority south-east.
Purge of public servants
Mr Erdogan came to power in 2002, a year after the formation of the 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.
His silencing of critics has caused alarm abroad, contributing to frosty relations with the EU which have stalled Turkey's bid to join the bloc.
Since the thwarted coup, nearly 50,000 people have been detained, including many soldiers, journalists, lawyers, police officers, academics and Kurdish politicians.
The authorities have sacked 120,000 public servants, and there are widespread complaints of AKP-inspired intimidation.
Mr Erdogan says the plot was engineered by Fethullah Gulen, a US-based Muslim cleric who used to be an ally.
Mr Gulen heads a global network of supporters - including Gulen schools - and his Hizmet movement has penetrated many areas of Turkish life. But he strongly denies plotting against the AKP government.
Mr Erdogan's authoritarian approach is not confined to Turkey's borders. His bodyguards harassed reporters in the US, and a German satirist was investigated in his home country for offending Mr Erdogan on TV.
In the run-up to the referendum Mr Erdogan was enraged by German and Dutch bans on his ministers addressing political rallies among the Turkish diaspora.
Politicians in both countries sharply rebuked him for calling those restrictions "Nazi" actions.
Rise to power
Born in February 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 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 and banned Welfare Party
1999 - Jailed for four months 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"
Aug 2001 - Founds Islamist-rooted AKP with ally Abdullah Gul
2002-2003 - AKP wins solid majority in parliamentary election, Erdogan appointed prime minister
June 2013 - Unleashes security forces on protesters trying to protect Gezi Park, a green area of Istanbul earmarked for a building project
Dec 2013 - Big corruption scandal batters his government - three cabinet ministers' sons are arrested, Erdogan blames Gulenists
Aug 2014 - Becomes president after first-ever direct elections for head of state
July 2016 - Survives attempted coup by factions within the military
April 2017 - Wins referendum on increased presidential powers
Mr Erdogan has denied wanting to impose Islamic values, saying he is committed to secularism. But he supports Turks' right to express their religion more openly.
That message is especially popular in rural and small-town Anatolia. 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.
A father of four, he has said "no Muslim family" should consider birth control or family planning. "We will multiply our descendants," he said in May 2016.
He has extolled motherhood, condemned feminists, and said men and women cannot be treated equally.
Critics see a lavish new presidential palace as a symbol of Mr Erdogan's grandiose ambitions.
Overlooking Ankara, the 1,000-room Ak Saray (White Palace) is bigger than the White House or Kremlin, and it cost even more than the original £385m ($482m) price tag.
Mr Erdogan owes much of his popularity to economic stability, with an average annual growth rate of 4.5%.
Turkey has become 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 with Israel, the policy made him hugely popular in the Arab world.
He has backed Syria's opposition in its fight against Bashar al-Assad's government in Damascus.
He sometimes gives a four-finger salute - the "rabaa"- in solidarity with Egypt's repressed Muslim Brotherhood.
His tentative peace overtures to the Kurds in south-eastern Turkey soured when he refused to help Syrian Kurds battling Islamic State jihadists.
Like previous Turkish leaders, he has cracked down hard on the outlawed Kurdistan Workers' Party (PKK), whose guerrilla war continues unabated.