Afghan and Western leaders have praised the turnout in Afghanistan's presidential election, describing the vote as a success.
It is the strife-torn nation's first transfer of power via the ballot box.
More than seven million Afghans out of an estimated 12 million eligible voted in the poll, the country's electoral commission says.
But there are reports of ballot paper shortages and sporadic violence from across the country.
Eight candidates are seeking to succeed Hamid Karzai, with a result expected in days.
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.
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."
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," 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, Ghani has strong support among the new urban youth vote, and Dr Rassoul is believed to favoured by Karzai.
However, no candidate is expected to secure more than the 50 percent 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," 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 this information was "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, and Nimroz province in the south-west - where 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.
Dr Abdullah, who pulled out of the 2009 vote before the second round amid allegations of voting irregularities, hailed Saturday's poll as a success. 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.
Traffic was prevented from entering the Afghan capital from midday on Friday, with police checkpoints erected at every junction.
However, in parts of the capital voters could be seen queuing an hour before polls opened and there was a good-natured, almost carnival atmosphere, with many people on the streets, our correspondent adds.
Across the country, 10 percent of stations were declared unsafe to open by the election commission.
The Afghan ministry of defence said three major incidents had taken place on polling day:
Three IEC staff and three Afghan military personnel were killed in a Taliban rocket attack on a polling centre in the north-eastern province of Kunduz
Twelve insurgents were killed and nine others wounded in a battle between the Afghan national army and insurgents in the north-western province of Badqhis
An Afghan soldier was killed in the eastern province of Logar
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.