Afghan and Western leaders have described Afghanistan’s presidential election and the turnout as a success.
The votes of more than seven million Afghans estimated to have taken part – out of an electorate of 12 million – are now being counted.
The election commission has received 162 allegations of fraud after the poll marked by sporadic violence and reports of ballot-paper shortages.
It marks the strife-torn nation’s first transfer of power via the ballot box.
Eight candidates are seeking to succeed President Hamid Karzai. A second round run-off between the top two contenders may be needed to decide the winner, correspondents say.
Three million more people voted in this presidential election than in the previous one, in 2009.
A massive operation was launched to thwart the Taliban, who had vowed to disrupt the election, and heavy rainfall may have depressed turnout in some areas.
Mr Karzai, barred by the constitution from seeking a third term, said after the polls closed: “Despite the cold and rainy weather and possible terrorist attack, our sisters and brothers nationwide took in this election and their participation is a step forward and it is a success for Afghanistan.”
US President Barack Obama, in a statement issued by the White House, said: “We commend the Afghan people, security forces, and elections officials on the turnout for today’s vote – which is in keeping with the spirited and positive debate among candidates and their supporters in the run-up to the election.
“These elections are critical to securing Afghanistan’s democratic future, as well as continued international support,” Mr Obama added.
UK Foreign Secretary William Hague said in a statement: “It is a great achievement for the Afghan people that so many voters, men and women, young and old, have turned out in such large numbers, despite threats of violence, to have their say in the country’s future.”
Nato military alliance chief Anders Fogh Rasmussen said the elections were “a historic moment for Afghanistan“.
Nato has co-ordinated much of the work of foreign forces in Afghanistan – most of them US and British troops – in a mission that will end this year.
“I congratulate the millions of Afghan men and women from across the country who have cast their votes in presidential and provincial council elections with such an impressive turnout and enthusiasm,” Mr Rasmussen said in a statement.
Although there are eight candidates for president, only three are considered frontrunners – former foreign ministers Abdullah Abdullah and Zalmai Rassoul, and former Finance Minister Ashraf Ghani Ahmadzai.
Analysts say Dr Abdullah has fought a polished campaign, Mr Ghani has strong support among the new urban youth vote, and Dr Rassoul is believed to favoured by Mr Karzai.
However, no candidate is expected to secure more than the 50% of the vote needed to be the outright winner, which means there is likely to be a second round run-off on 28 May.
Afghanistan’s Independent Electoral Commission (IEC) chairman Ahmad Yousuf Nouristani said its latest estimates were that more than seven million people had voted by 17:00 local time, when the polls had officially closed and counting began.
Two-thirds of those who voted were men and one third women, the commission believes. Some polling stations stayed open for another four hours to allow everyone queuing to vote.
“This election was a message to the enemies of Afghanistan,” Mr Nouristani said. “With this determination of the honourable people of Afghanistan, the enemies were defeated.”
IEC secretary Ziaul Haq Amarkhel, asked to comment on widespread reports of polling stations running out of ballot papers, said they were “false”.
But BBC correspondents received reports of polling centres running out of ballots hours before the polls closed in many areas, including Kabul, northern Takhar province, north-eastern Badakhshan province, eastern Paktia province.
In Nimroz province in the south-west, one man, Abdul Ahad, said he and 15 family members had been to every polling centre in their district in an attempt to vote, but all of them had run out of ballot papers.
However, he complained that large numbers of voters had been deprived of their right to take part because of a lack of ballot boxes.
The biggest military operation since the fall of the Taliban in 2001 was rolled out for the vote, says the BBC‘s David Loyn in the Afghan capital. All 400,000 of Afghanistan’s police and soldiers were said to be on duty for the election.
Fears of fraud, which have marred previous polls in Afghanistan, resurfaced with reports from the southern province of Kandahar that police were preventing voters and observers from reaching polling stations.
The interior ministry said two police officers were arrested in Wardak province for stuffing ballot boxes.
Concerns were also raised before the poll about the possible presence of “ghost” polling stations as well as the fact that the number of election cards in circulation appeared to be vastly more than the number of registered voters.