Afghans braved chaotic delays outside polling stations and the threat of militant attacks to vote in parliamentary elections on Saturday that were seen as a major test of the Western-backed government's credibility.
A suicide bomber killed 15 people in Kabul, the most serious of a series of smaller-scale attacks that caused dozens of casualties across the country but did not deter voters who endured long queues to cast their ballot.
"Today the people gave an unanswerable response to the enemies of Afghanistan," government spokesman Haroon Chakansuri told reporters.
Voting should have been over by the time the suicide bomber struck a polling station in the north of Kabul, killing 10 civilians and five police, but polling stations were kept open longer than normal to cope with large numbers of people who had been unable to cast ballots.
Turnout was higher than expected, with long lines forming outside polling centres in the main cities, but many voters were forced to endure extended waits because of technical and organisational problems.
"People's enthusiasm and participation despite threats, intimidation and attacks by militants must be lauded today," said one senior international security official, who added: "The electioneering process will require close scrutiny as it is clear that there were multiple failures."
Untested biometric voter-registration equipment, rushed in at the last minute to counter voter fraud, caused particular problems.
The Transparent Election Foundation of Afghanistan, a civil action group, said the devices suffered malfunctions in more than 40 percent of polling centres.
"The biggest problem is with the biometric machines, there are some sites where they're not working and a lot of voters have been discouraged and have gone home," said Nasibullah Sayedi, a voter in the western city of Herat.
The Independent Election Commission (IEC), the body overseeing the ballot, said voting hours would be extended in some centres to cope with demand and some polling stations, which had not opened at all, would be open on Sunday.
In the days leading to the vote, Taliban militants issued a series of statements telling people not to take part in what they consider a foreign-imposed process and warning election centres may be attacked.
Security officials said there were more than 120 hand grenade or improvised explosives attacks but they said many of these did not target voting centres but were aimed nearby, apparently with the aim of frightening voters away rather than causing casualties.
Afghanistan's political scene is still tainted by the aftermath of a disputed presidential vote in 2014 that forced the two main rival groupings to form an unstable partnership.
Both sides were accused of massive electoral cheating.
But high turnout, at least in the major cities, reflected strong support for the process in the face of threats from militant attacks and widespread disillusion with a corrupt political class.
"I want candidates to serve the country and hear the voices of the disabled and the poor," said Abdullah, a wheelchair-bound voter in Herat. "People ask what difference one person's vote will make but I say, if a million disabled people come out to vote, don't you think that will make a difference?"
In Baghlan province in northern Afghanistan, men and women came out in numbers to vote and created human chains around six polling stations to prevent the entry of suicide bombers.
The United Nations Assistance Mission in Afghanistan issued a statement welcoming the high numbers who voted and said authorities must ensure the election was completed successfully.
It also called on candidates and political parties to play a constructive role "to safeguard the integrity of the electoral process as votes are tallied."
However numerous allegations of voter fraud made before election have presented a challenge to the legitimacy of the process, seen by Afghanistan's international partners as a vital step ahead of more important presidential elections next year.
Due to the difficulty of collecting and collating results across Afghanistan, the overall results will not be known for at least two weeks.
Some 8.8 million voters have been registered but an unknown number, by some estimates as many as 50 percent or more, are believed to be fraudulently or incorrectly registered.
About 2,450 candidates are competing for places in the lower house, which has 250 seats, including one reserved for a candidate from the Sikh minority. Under the constitution, parliament reviews and ratifies laws but has little real power.
Election authorities originally planned 7,355 polling centres but only 4,530 were open due to security concerns, according to the IEC.
Voting was postponed for a week in Kandahar province after the assassination of the powerful local police chief Gen. Abdul Razeq. The ballot was also delayed in Ghazni province by arguments about the representation of different ethnic groups.