Istanbul mayoral re-run: Millions vote in election key for Erdogan
Istanbul residents have been voting to elect a new mayor after an opposition candidate's surprise victory in March was annulled.
Ekrem Imamoglu won by 13,000 votes, prompting allegations of irregularities from Turkey's ruling AK party.
Mr Imamoglu has vowed to "battle for democracy" and polls say he is likely to beat former Prime Minister Binali Yildirim for a second time.
The vote is being seen as a key test for President Recep Tayyip Erdogan.
As a former mayor of Istanbul - Turkey's economic and cultural centre, home to 15 million people - Mr Erdogan has often said that "he who wins Istanbul wins Turkey".
Polls closed at 17:00 local time (14:00 GMT) and results are expected later on Sunday.
Who are the candidates?
Mr Imamoglu, 49, is from the secular Republican People's Party and is mayor of Istanbul's Beylikduzu district.
His opponent Mr Yildirim was a founding member of Mr Erdogan's AKP and was prime minister from 2016 until 2018, when Turkey became a presidential democracy and the role ceased to exist.
He was elected Speaker of the new parliament in February and before that served as minister of transportation and communication.
Mr Imamoglu's name was barely known before he ran for mayor in the March election.
His campaign message - "everything will be all right" - has struck a note of optimism in a city where many have become disillusioned following an an economic recession that some blame on the government.
When he was stripped of his victory in the March election, Mr Imamoglu told supporters: "We will win back our rights with a smile on our face."
He also said he would "embrace those who resist us".
Turkey's most powerful leader in its modern history doesn't take defeat easily.
When his party lost his home city of Istanbul in March, he cried foul. The election board, which later ordered a re-run, is believed to have buckled under the pressure.
But it's a gamble that could backfire.
The opposition candidate, Ekrem Imamoglu, has seized on the widespread desire for change in this polarised, angry, country. If Mr Erdogan's candidate, former Prime Minister Binali Yildirim, loses, there will be those asking if it is the beginning of the end for the president.
Mr Erdogan has made this an intensely personal contest - he's framed it as a matter of survival. But with a spluttering economy and doubts over the validity of the re-run, some of his usually loyal voters are expected to switch sides.
Victory in the election would secure his hold over Turkey. But a loss, particularly by a larger margin than in March, would hasten splits within his AK party and fuel speculation over the post-Erdogan era.
Why was the previous result annulled?
Mr Imamoglu's narrow victory margin of 13,000 votes was not enough for Mr Yildirim to accept defeat.
- Turkey's rulers are bad losers, says election 'winner'
- Erdogan disputes Turkey poll results in big cities
The ruling party alleged that votes were stolen and many ballot box-watchers did not have official approval, leading the election board to demand a rerun of Istanbul's mayoral election.
Critics argue that pressure from President Erdogan was behind the decision.
Why is this election so important?
Mr Erdogan was himself elected Istanbul mayor - his home city - in 1994.
He founded the AKP in 2001 and served as prime minister between 2003 and 2014, when he became president.
However cracks in the AKP are now beginning to show which could be exacerbated if the party loses this election.
"Erdogan is extremely worried," said journalist and writer Murat Yetkin.
- Istanbul re-run a risky strategy for Erdogan
- Why Erdogan's big ambitions could come tumbling down
- Erdogan: Turkey's pugnacious president
"He is playing every card he has. If he loses, by whatever margin, it's the end of his steady political rise over the past quarter of a century," he added.
"In reality, he'll still be president, his coalition will still control parliament - although many will perceive his defeat as the beginning of the end for him."