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.
But in recent years the economy has deteriorated. Inflation is nearly 12% and the Turkish lira has slumped against the dollar. Coronavirus is exacerbating Turkey's economic woes.
When he became Turkish leader back in March 2003 the lira rate was 1.6 to the dollar - now it is above 8.0. His early years in power were marked by solid growth and a development boom.
In recent months President Erdogan has pushed harder to project Turkish power abroad. That has riled many countries, not least the EU and Turkey's Nato allies.
The Turkish military has become involved in the conflicts in Libya, Syria and, indirectly, Nagorno-Karabakh in the Caucasus.
The Turkish army held joint exercises with Azerbaijan just weeks before heavy fighting erupted between Azerbaijan and the Armenians controlling Nagorno-Karabakh. The territory is recognised internationally as part of Azerbaijan.
The Turkic Azerbaijanis are traditionally close to Turkey, and the oil-rich state has key export pipelines transiting Turkey. But Russia has for centuries treated the Caucasus as its sphere of influence.
In the Caucasus, and the wars in Libya and Syria, Mr Erdogan's ambitions clash with Russian President Vladimir Putin's.
Untapped gas reserves in the Eastern Mediterranean are part of Mr Erdogan's geopolitical agenda.
Turkish gas exploration off Cyprus has infuriated the governments of Cyprus and Greece - both EU members - and brought him sharp warnings from the EU.
He scorns Western pressure and has embraced Turkish nationalist leaders in northern Cyprus, a self-styled "republic" recognised only by Turkey.
He lashed out at French President Emmanuel Macron, questioning his mental health, because of Mr Macron's crackdown on Islamist influence in France.
Mr Erdogan has long championed Islamist causes - groups ideologically close to Egypt's repressed Muslim Brotherhood. He has been known to give the latter's four-finger salute - the "rabaa".
In July 2020 he oversaw the conversion of Hagia Sophia - an Istanbul landmark - into a mosque, angering many Christians.
It was built 1,500 years ago as a cathedral, and made a mosque by the Ottoman Turks, but Ataturk had turned it into a museum - a symbol of the new secular state.
Ruling party challenged
Last year Mr Erdogan's Islamist-rooted AKP (Justice and Development Party) won local elections nationally, but lost in the three biggest cities - Istanbul, the capital Ankara and Izmir.
Losing the Istanbul mayorship narrowly to the main opposition Republican People's Party (CHP) was a bitter blow to Mr Erdogan, who was the city's mayor in the 1990s.
Most of the AKP's core voters are in small Anatolian towns and rural, conservative areas.
Mr Erdogan first rose to prominence in Istanbul, now a city of some 16 million. It was there and in Ankara that the AKP turned local success into a national political steamroller, becoming Turkey's dominant party for years.
In June 2018, he won a new five-year term after securing outright victory in the first round of a presidential poll.
It granted him sweeping new presidential powers, won in a controversial referendum in 2017. That constitutional change was tight, however - the Yes vote was 51%.
His powers include:
- Directly appointing top public officials, including ministers and vice-presidents
- The power to intervene in the country's legal system
- The power to impose a state of emergency
Beefing up the presidency was accompanied by a massive purge of state institutions.
That purge came after a July 2016 coup attempt that nearly toppled Mr Erdogan. His grip on power was seriously challenged by military officers - and his response was mass arrests and show trials.
The crackdown drew a chorus of criticism from Western politicians and human rights groups.
In 1960 and three more times in later decades the Turkish army intervened in politics, seeing itself as the guarantor of Kemal Ataturk's secular republic.
Its shadowy nationalist influence behind the scenes came to be known as "the deep state".
The AKP has shown a fierce determination to clip the military's wings.
The failed 2016 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.
His critics call him 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.
Mr Erdogan came to power nationally in 2003 and spent 11 years as 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 has stalled Turkey's bid to join the bloc.
Since the thwarted coup, more than 50,000 people have been detained, including many soldiers, journalists, lawyers, police officers, academics and Kurdish politicians.
The authorities have sacked an estimated 150,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.
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.
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 initially owed much of his popularity to economic stability, with an average annual growth rate of 4.5%. Turkey became a manufacturing and export powerhouse.
But in 2014 the economy began flagging - growth fell to 2.9% and unemployment rose above 10%.
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).