Media playback is unsupported on your device Media caption Women made up 34% of those voting, says the National Electoral Commission

More than seven million Afghans out of an estimated eligible 12 million voted in the election for a new president, the country's electoral commission says.

It is the strife-torn nation's first transfer of power via the ballot box.

There are reports of ballot paper shortages and sporadic violence from across the country.

Eight candidates are seeking to succeed Hamid Karzai, barred by the constitution from seeking a third term.

Mr Karzai has declared Saturday's poll "a success". Final results may not be declared for 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.

Media playback is unsupported on your device Media caption Abdul Malik Niazi says he is proud to have voted

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 until 21:00 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."

Analysis In Kabul, and other cities there was tight security and heavy rain - but long lines of voters. They waited patiently to participate in a process that both voters and election officials took pride in. With ballot papers running out and long queues, the election commission extended voting by an hour to allow the process to be completed. In the countryside the story was more mixed, with sporadic Taliban violence in the east. A bigger threat to the election than violence might be fraud. There are several reports that the police in Kandahar province in the south turned both voters and election observers away from polling stations. One elder told the BBC that election observers had been beaten by police. The fear is that police will fill in the ballots themselves and stuff the boxes.

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.

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 reports.

Across the country, 10% 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

Image copyright AP Image caption There was tight security across the country amid fears of Taliban attacks

Image copyright AP Image caption Voters were choosing from eight candidates

Image copyright AP Image caption Long queues built up at some polling stations

Image caption For some voters, a finger stained with identifying ink has become a badge of pride - and defiance

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.

Speaking after the polls closed, Mr Karzai said: "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."

Key questions about the vote What are the main issues? A final security agreement with the US is the most pressing issue. All other matters, from trying to bring the Taliban to the negotiating table to fighting corruption and the drugs trade, depend on this

A final security agreement with the US is the most pressing issue. All other matters, from trying to bring the Taliban to the negotiating table to fighting corruption and the drugs trade, depend on this Will the vote be free and fair? There is widespread concern about ballot stuffing and ghost polling stations - the kind of cheating that has marked every election since 2004

There is widespread concern about ballot stuffing and ghost polling stations - the kind of cheating that has marked every election since 2004 Has security been a major logistical problem? Yes. The Taliban had vowed to disrupt the vote and there were a string of attacks leading up to it. But security at this election has been tighter than in previous votes

Yes. The Taliban had vowed to disrupt the vote and there were a string of attacks leading up to it. But security at this election has been tighter than in previous votes What happens if no-one wins? If, as expected, no candidate wins more than 50% of the vote, the two top contenders will go to a run-off on 28 May Why the polls matter - in 60 seconds Leaving Helmand to uncertain future

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."

British Foreign Secretary William Hague said: "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."

There are eight candidates for president, but three are considered frontrunners - former foreign ministers Abdullah Abdullah and Zalmai Rassoul, and former Finance Minister Ashraf Ghani Ahmadzai.

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 Hamid Karzai, our correspondent says.

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.

In the latest in a string of deadly attacks that marred the lead-up to the election, award-winning German photographer Anja Niedringhaus was killed and veteran Canadian reporter Kathy Gannon was injured when a police commander opened fire on their car in the eastern town of Khost on Friday.

Interior Minister Omar Daudzai told the BBC that the man being held over the shooting might have acted under the influence of "stress" and added he thought it was a "one-off incident" unconnected to the Taliban.

The run-up to the historic poll has been the bloodiest since the fall of the Taliban, says the BBC's Lyse Doucet in Kabul.

The heavily guarded interior ministry, the main compound of the IEC and the five-star Serena Hotel, popular with foreigners, have all been attacked.

Did you vote in this election? Did you feel confident about the security arrangements? Email haveyoursay@bbc.co.uk with 'Afghan election' in the subject field.