Turkish President Recep Tayyip Erdogan suffered a severe setback as his ruling AK Party lost control of the capital, Ankara, for the first time in a local election and he appeared to concede defeat in the country's largest city, Istanbul.

Erdogan, who has dominated Turkish politics since coming to power 16 years ago and rules his country with an ever tighter grip, campaigned relentlessly for two months ahead of Sunday's vote, which he described as a "matter of survival" for Turkey.

But the president's daily rallies and overwhelmingly supportive media coverage failed to win over the country's capital or secure a definitive result in Istanbul, as Turkey's economic downturn weighed heavily on voters.