Turkish President Tayyip Erdogan faces his toughest political challenge yet when the nation votes on Sunday, with the opposition sensing its best chance yet of ending his two decades in power and reversing his policies.
The presidential and parliamentary votes, set for May 14 with a possible May 28 run-off, will decide not only who leads Turkey but also how it is governed, where its economy is headed, and the shape of its foreign policy.
Modern Turkey's longest-serving leader, Erdogan has championed religious piety and low interest rates at home while asserting Turkish influence in the region and loosening the NATO member's ties with the West.
The election takes place three months after earthquakes in southeast Turkey killed more than 50,000 people.
Erdogan's main challenger is Kemal Kilicdaroglu, the leader of the secularist Republican People's Party (CHP), who has the backing of an alliance of six opposition parties.
WHAT'S AT STAKE FOR TURKEY ...
The most powerful leader since Mustafa Kemal Ataturk founded the modern Turkish republic a century ago, Erdogan and his Islamist-based AK Party have shifted Turkey away from Ataturk's secular blueprint.
Erdogan has also centralised power around an executive presidency, based in a 1,000-room palace on the edge of Ankara, which sets policy on Turkey's economic, security, domestic and international affairs.
Erdogan's critics say his government has muzzled dissent, eroded rights and brought the judicial system under its sway, a charge denied by officials who say it has protected citizens in the face of unique security threats including a 2016 coup attempt.
Economists say Erdogan's calls for low interest rates sent inflation soaring to a 24-year high of 85% last year, and the lira slumping to one tenth of its value against the dollar over the last decade.
... AND THE REST OF THE WORLD?
Under Erdogan, Turkey has flexed military power in the Middle East and beyond, launching four incursions into Syria, waging an offensive against Kurdish militants inside Iraq and sending military support to Libya and Azerbaijan.
Turkey also saw a series of diplomatic clashes with regional powers Saudi Arabia, Egypt, the United Arab Emirates and Israel, as well as a stand-off with Greece and Cyprus over eastern Mediterranean maritime boundaries, until it changed tack two years ago and sought rapprochement with some of its rivals.
Erdogan's purchase of Russian air defences triggered U.S. arms industry sanctions against Ankara, while his closeness to Russian President Vladimir Putin led critics to question Turkey's commitment to the NATO Western defence alliance. Ankara's objections to NATO membership applications from Sweden and Finland have also raised tensions.
However, Turkey also brokered a deal for Ukrainian wheat exports, underlining the potential role Erdogan has staked in efforts to end the Ukraine war. It is not clear that a successor would enjoy the same profile he has created on the world stage, a point he has made in the election campaign.
WHAT IS THE OPPOSITION PROMISING?
Two main opposition parties, the secularist CHP and centre-right nationalist IYI Party, have allied themselves with four smaller parties under a platform that would reverse many of Erdogan's signature policies.
They have pledged to restore independence to the central bank and reverse Erdogan's unorthodox economic policies. They would also dismantle his executive presidency in favour of the previous parliamentary system, and send back Syrian refugees.
They also aim to improve relations with Western allies and including the United States, and to return Turkey to the F-35 fighter jet programme, from which it was blocked after buying Russian missile defences.
Analysts believe the policies promised by the opposition could spur foreign investment.
Erdogan supported failed efforts to topple Syrian President Bashar al-Assad, while hosting at least 3.6 million Syrian refugees who have become increasingly unwelcome at a time of economic hardship in Turkey.
The opposition has echoed Erdogan's plans to return some refugees to Syria, but neither has set out how that could safely take place.
JUST HOW CLOSE IS THE RACE?
The latest survey by the closely-watched pollster Konda showed Kilicdaroglu more than five percentage points ahead of Erdogan, whose popularity has been hit by a cost-of-living crisis caused by rampant inflation. The united face presented by the opposition alliance has buoyed its chances, analysts say.
In a further boost for Kilicdaroglu, candidate Muharrem Ince, one of four contesting Sunday's vote, withdrew on Thursday.
But Erdogan is still in the running, and the presidential race may well go to a runoff between him and Kilicdaroglu.
Initial polls after the Feb. 6 earthquake had suggested that he was able to largely retain support despite accusations the government had been slow to respond and had laxly enforced building regulations that may have saved lives.
How the opposition will garner support among the Kurdish voters, accounting for 15-20% of the electorate, remains key.
The pro-Kurdish Peoples' Democratic Party (HDP) is not part of the main opposition alliance but fiercely opposes Erdogan after a crackdown on its members in recent years.
(Reporting by Dominic Evans; Editing by Tom Perry, Jonathan Spicer, Alexandra Hudson)