Afghan President Hamid Karzai and his Western allies have pronounced the country's election a success, after voting passed off largely peacefully.
Mr Karzai hailed Afghans for braving Taliban "bombs and intimidations". His praise was echoed by the US and Nato.
There were some attacks by insurgents, but the UN says the vast majority of polling stations were able to function.
President Karzai is facing challenges from about 30 rivals. Official results are not expected for two weeks.
"The Afghan people dared rockets, bombs and intimidations," he told reporters as polls closed following a one-hour extension.
Mr Karzai praised the citizens who turned out to vote
"We'll see what the turnout was. But they came out to vote. That's great."
In Washington, White House spokesman Robert Gibbs said: "Lots of people have defied threats of violence and terror to express their thoughts about the next government for the people of Afghanistan."
Mr Karzai said that based on reports by the interior ministry, 73 attacks had taken place in 15 provinces.
Among the violent incidents reported:
Taliban militants stormed a town in Baghlan, northern Afghanistan, preventing polling stations from opening, police tell AFP news agency. At least eight died in ensuing clashes with police
Taliban militants set fire to a bus on the Kandahar-Kabul highway in Ghazni, after offloading passengers and the driver, reportedly as punishment for violating a Taliban ban on using the road
Rockets hitting houses in Khost and Kandahar provinces killed two women and several children
More than 20 rockets landed in the capital of Lashkar Gah, the capital of Helmand province, a Taliban stronghold
In northern Baghlan province, a district police chief was killed when Taliban militants attacked a police post
Some 300,000 Afghan and Nato troops were on patrol to prevent attacks during the presidential and local polls.
Kai Eide, the head of the UN mission in Kabul said that overall, the security situation had been "better than we feared" and had "allowed people to take part in the elections".
John Simpson, BBC News, Kabul
The judgement that is starting to emerge in the presidential palace here in the headquarters of the international force and in the British and American embassies seems likely to be one of relief. It did not go too badly.
We will not know for some time whether President Karzai will have to face the mild humiliation of going through a second round or whether he managed to summon up sufficient votes to win this time.
But we do know that the blood-curdling threats of the Taliban have not amounted to very much, any more than they did at the last presidential election in 2004.
That is a big victory for the immense security operation which reached its culmination on Thursday. Yet, as we saw five years ago, just because the Taliban have lost a certain amount of face, it will not take them long to bounce back.
Nato Secretary General Anders Fogh Rasmussen hailed the vote as "a testimony to the determination of the Afghan people to build democracy".
UN Secretary General Ban Ki-moon, for his part, issued a statement congratulating "the women and men of Afghanistan on today's presidential and provincial council elections".
The polls are the first organised primarily by Afghans themselves.
Speaking on state TV, the director of Afghanistan's Independent Election Commission, Azizullah Loudin, claimed turnout had been "high".
Apart from the earlier gun battle in Kabul, the city was mainly reported to be quiet, with a brisk turnout in some polling stations while there was little activity in others.
Fewer people voted in the south and east, where militant influence is greater.
In Jalalabad, in the eastern province of Nangarhar, some districts reported no voters at all.
In the southern city of Kandahar - the historical stronghold of the Taliban - a voting official told AP news agency that turnout appeared to be 40% lower than during the 2004 election.
17 million eligible voters
Polls opened at 0700 (0230 GMT) and close at 1600
As well as presidential polls, voters choosing between 3,000 candidates for 420 seats in provincial councils
Official preliminary results not expected for two weeks but may be earlier indications
300,000 troops on patrol (including 100,000 foreign troops)
250,000 observers and journalists
First polls organised by Afghans themselves, but with international support
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.