ANKARA (AFP) - The modern state of Turkey emerged out of the wreckage of the Ottoman Empire to become a powerful strategic nation that borders Greece to the west and Iran to the east.
It has been ruled since 2002 by the Islamic-rooted conservative party of President Recep Tayyip Erdogan. He has overseen some of the biggest changes since modern Turkey was created in 1923.
But in presidential and legislative polls on Sunday, Erdogan and his party will face the biggest test at the ballot box to their one-and-a-half-decade grip on power.
Here are five facts about Turkey.
Successor to an empire
At its peak, the Ottoman Empire ruled a swathe of territory extending from the Balkans to modern Saudi Arabia, including the holy sites of Islam.
But the Empire suffered centuries of decline and its end was confirmed by defeat in World War I, in which it had fought on the side of imperial Germany.
After a War of Independence, Turkish military leaders including Mustafa Kemal Ataturk were able to salvage a modern state extending from Thrace to Mesopotamia, declaring the creation of the Republic of Turkey in 1923.
Under Erdogan, Turkey has sought to rebuild its Ottoman-era influence in the Middle East, notably in Syria and Iraq as well as the Balkans and also Africa.
Secular, Western democracy
Ataturk, Turkey s first president until his death in 1938, turned the country towards the West and made secularism one of its founding principles.
Multi-party democracy was introduced in 1946. Under Ataturk s successor Ismet Inonu, Turkey remained neutral in World War II.
In 1952 it joined NATO along with its one-time foe Greece with the strong backing of the United States, keen to ensure Ankara never fell into the orbit of the USSR.
Critics have accused Erdogan of increasing authoritarianism, presiding over a creeping Islamisation and changing Turkey s Western tilt. But the president insists he is committed to a secular republic anchored in NATO.
Scarred by coups
Turkey s powerful military ousted incumbent governments in coups in 1960, 1971 and 1980.
The 1960 coup was followed by the hanging of ousted prime minister Adnan Menderes -- Erdogan s political hero -- along with two ministers.
After coming to power, Erdogan clipped the wings of the military in a bid to make political interventions by the army far less likely.
But in July 2016 he survived a coup attempt by a renegade army faction.
Erdogan said that attempt was ordered by his one-time ally, the US-based preacher Fethullah Gulen, who denies the charges.
Erdogan then declared a state of emergency that has seen some 55,000 people arrested in an unprecedented purge. He -- and the opposition -- have vowed to lift the emergency after the elections.
Host to refugees
The country of over 80 million has sought to boost its influence, staunchly opposing the regime of President Bashar al-Assad in Syria s civil war but then working closely with his ally Russia to end the conflict.
Turkey has taken in around 3.5 million Syrian refugees, who live mainly in the southeast and Istanbul, as well as smaller numbers from Iraq and Afghanistan.
In 2016, it signed a deal to limit the flow of refugees to Europe after one million crossed the Aegean through Turkey in 2015. The deal was seen as a boost to Turkey s hopes of joining the European Union but the process has floundered ever since.
Turkey has given passports to a few tens of thousands of Syrian refugees bur critics say it lacks a strategy to deal with their long-term presence.
The non-Muslim minorities on the territory of modern Turkey were forced out in the 20th century and only small populations remain today.
Armenians regard the killings and massacres of their ancestors as genocide, a term vehemently disputed by Turkey. Most Greeks left the country in the population exchanges of 1923.
By far Turkey s largest ethnic minority are the Kurds. They make up a fifth of the population and have long complained of being denied their rights in what they call the "Kurdish problem".
The outlawed Kurdistan Workers Party (PKK) took up arms in 1984 in a bloody insurgency that has left tens of thousands dead.
Erdogan in the first years of his rule took unprecedented steps towards giving the Kurds greater rights and opened talks with the PKK. But a ceasefire unravelled in 2015 and violence continues, with still no peace deal in sight.