Turkish President Recep Tayyip Erdogan (L) shakes hands with a girl after voting in Turkey's general election at a polling station in Istanbul on June 7, 2015
Ankara (AFP) - Recep Tayyip Erdogan, who has dominated Turkey for over a decade first as premier and now as president, has suffered the worst election setback of his career in legislative polls amid increasing controversy over his polarising rule.
The Justice and Development Party (AKP) co-founded by Erdogan won the most votes in Sunday's elections but lost its absolute majority in parliament for the first time since it came to power in 2002.
The result has scuttled Erdogan's plan to push through the constitutional changes he yearns for to create a presidential system that would give him greater powers.
Erdogan, 61, who served as premier from 2003 and then became president in 2014, is lauded by his supporters as a transformative figure who modernised Turkey and handed power back to the people from the secular and military elite.
But in the last two years he has become an increasingly divisive figure, hated by large numbers of secular Turks who see him as an autocrat bent on Islamising the country.
His vast new $615 million presidential palace on the outskirts of Ankara, slammed by the opposition as an absurd extravagance, has become a symbol of his perceived aloofness and authoritarianism.
During the election campaign Erdogan was more divisive than ever, showing no mercy in attacks on opponents and telling foreign media who criticised him to "know your limits".
With an eye on his legacy, Erdogan wants to be ranked alongside Turkey's post-Ottoman founding father Mustafa Kemal Ataturk as one of its great transformative figures and could stay in power to 2024.
A towering figure of almost two metres tall with a notoriously fiery temper, he is known to himself and followers as the "buyuk usta" -- the "big master" -- or simply as "the Sultan".
- 'AKP is my child' -
The son of a coastguard officer in Istanbul's harbourside neighbourhood of Kasimpasa, Erdogan spent his earliest years in the region of Rize by the Black Sea but returned to Istanbul by his early teens.
He took a degree in business administration and, a promising footballer, even played semi-professional football for an Istanbul club.
Under his late mentor Necmettin Erbakan, who would later become prime minister, Erdogan rose to prominence in the Islamic movement.
He became mayor of Istanbul in 1994, tackling urban woes such as traffic gridlock and air pollution in the megacity of more than 15 million people.
When his religious party was outlawed, he joined demonstrations and was briefly jailed for four months for reciting an Islamist poem which the court regarded as incitement to religious hatred.
In 2001 Erdogan and his long-time ally, the former president Abdullah Gul, co-founded the Islamic-rooted AKP, which has won every election since 2002.
"The AKP is my fifth child," says Erdogan, who has two sons and two daughters.
Initially barred from becoming premier due to his criminal conviction, he rose to be head of government in 2003 when parliament passed new reforms.
Under his rule, Turkey showed stellar growth rates that were the envy of other emerging markets and adopted an increasingly confident position on the international stage.
He famously walked out of a World Economic Forum debate with the then Israeli president Shimon Peres in 2009, in a moment that symbolised Turkey's more assertive foreign policy stance.
But from 2013, Erdogan started to encounter challenges to his rule, to which he reacted in a combative rather than conciliatory fashion.
The 2013 protests over plans to build a shopping mall on a Istanbul park provided a rallying cause for secular Turks.
Even as some voices within the ruling party urged moderation, Erdogan came out fighting, famously slamming the protesters as "capulcu" (hooligans).
The anger came to a head again over his response to a mine tragedy in the western town of Soma in May 2014 that claimed 301 lives, when he attempted to downplay the incident by comparing it to mining disasters in 19th-century Britain.
Erdogan, who took the presidency in Turkey's first-ever direct elections for head of state in August 2014, responded by becoming even more pugnacious.
Last year, the authorities launched a crackdown against allies of his number one enemy, the Pennsylvania-based cleric Fethullah Gulen, an estranged former ally whom Erdogan accuses of creating a "parallel state" aimed at toppling his government.