Voters in Afghanistan are deciding who will succeed President Hamid Karzai after run-off polls.
The choice was between former Foreign Minister Abdullah Abdullah and ex-World Bank economist Ashraf Ghani.
The head of the election commission said turnout was good and most polling stations had opened but admitted some places had run out of ballot papers.
The Taliban threatened to target voting, and there are concerns that fraud could produce a disputed result.
It should be the first time that power in Afghanistan has been democratically transferred.
As most foreign soldiers prepare to withdraw by the end of this year, whoever becomes the new leader faces multiple challenges.
Taliban insurgents remain active, the economy is weak, corruption is endemic and the rule of law goes largely unenforced.
About 12 million Afghans are eligible to vote. Polls closed at 16:00 local time but officials said those in line at that time could still vote.
The election commission said 6,204 polling centres had opened, but about 160 remained closed because of security threats.
Abdullah Abdullah won 45% of the first-round vote, with Ashraf Ghani securing 31.6% – neither achieved the 50% needed to avoid a second round.
Both sides have faced multiple claims of fraud.
Correspondents say that a seamless transfer of power would be a significant achievement for Afghanistan and a vindication of international efforts to establish a functioning democracy after the abuses of the Taliban era.
But Afghanistan’s mountainous and remote terrain, coupled with the dilapidated condition of many of its roads, mean that holding a country-wide election is a major challenge. Thousands of donkeys will be deployed to carry ballot boxes to some of the more inaccessible villages.
The preliminary result is expected on July 2 and the final result on July 22.
[youtube XWhMJM58NDM 650]