Born in a blue-collar Istanbul neighbourhood, Recep Tayyip Erdogan became modern Turkey's most powerful prime minister but is now under fire over corruption claims and an autocratic leadership style.
After 11 years at the helm, the man dubbed the "Sultan" by his loyal followers has been accused of seeking "one-man rule" and erratically lashing out at critics, from former allies to street protesters and Twitter users.
Months of political turmoil have cast a shadow over Erdogan, who was long hailed as the leader of an emerging global player and a model Muslim democracy and oversaw a decade of unprecedented economic growth.
Ahead of key local elections Sunday, the 60-year-old has pushed his campaign motto, "Iron Will", on billboards blanketing the nation, even as he has endured scathing social media mockery from the tech-savvy children of the boom years.
As tales of official graft and sleaze have spread via smartphones and laptops, Erdogan has branded his critics "traitors" and "terrorists" and purged thousands in the police and judiciary.
Erdogan was born in 1954, the son of a coast guard officer in Istanbul's harbourside neighbourhood of Kasimpasa, where as a teenager he sold bread and lemons on the streets.
He joined Islamic youth groups that challenged the era's secular-nationalist regimes and the coup-happy generals who saw it as their duty to ensure a strict separation between mosque and state.
Erdogan, a one-time semi-professional football player and a business graduate, in 1994 became mayor of Istanbul, now a megacity of more than 15 million people, where he pragmatically tackled urban woes such as traffic gridlock and air pollution.
When a Muslim party was outlawed, he joined demonstrations and was briefly jailed for allegedly reciting an Islamist poem which the court regarded as incitement to religious hatred.
In 2001 Erdogan and now President Abdullah Gul co-founded the Islamic-rooted Justice and Development Party (AKP), which scored a landslide win the following year and two more victories since.
Once in power, Erdogan eased restrictions on women wearing the veil and took other steps to Islamise the staunchly secular society, limiting alcohol sales and making efforts to ban mixed-sex dorms at state universities.
Erdogan took a big political risk when he launched peace talks in 2012 with the outlawed Kurdistan Workers' Party (PKK) and became a popular figure on the Arab street for his staunch support of the Palestinian cause.
Erdogan has been credited with bringing stability after a history of once-a-decade coups and rocky coalitions, and clipping the wings of the powerful military.
A fan of new bridges, airports and other megaprojects, he has transformed what was once an economic basket-case into a robust market, tripling the income of ordinary Turks and reining in runaway inflation.
It was plans for another new development -- an Ottoman-style shopping mall that would force the razing of Istanbul's Gezi park -- that last June sparked unprecedented protests against the ruler, which police broke up with truncheons, plastic bullets and tear gas.
The unrest was followed in December by a wave of leaked phone recordings that spread on social media, with murky tales of ministerial bribe-taking, gold smuggling, illicit Iran deals and shoeboxes stuffed with cash.
Erdogan had to reshuffle his cabinet after three ministers resigned over the graft probe, and was forced to fend off allegations his own son was facing investigation.
His response was a massive purge of police and justice officials, as well as a ban of Twitter, which further alienated millions in the youthful country before it was overturned by a court this week.
The bellicose leader blames his woes on an erstwhile ally, powerful US-based preacher Fetullah Gulen, firing off almost daily tirades about coup plots and foreign conspiracies to bring down his AKP.
Opposition leader Kemal Kilicdaroglu has accused Erdogan of wanting to establish "one-man rule in Turkey", an assessment shared by many political analysts.
"He is maintaining his power at the cost of dismantling much of the facade on which he built it: as a forward-looking, democratic leader," said US think-tank the Bipartisan Policy Center in a recent report.
"He has lost most of his international legitimacy, and even though he maintains a devoted base of followers, he has clearly lost the aura of an invincible leader that he commanded domestically only a year ago.