Afghanistan's first parliamentary elections in eight years have been marred by violence, with a multitude of attacks leaving at least 36 people dead.
Among those killed were 27 civilians, eight police officers and a soldier, the country's Deputy Interior Minister Akhtar Mohammed Ibrahimi said.
He added that attackers used everything from grenades to small arms fire to mortars and rocket launchers, and that security forces killed 31 insurgents.
The most serious attack on the polls was in a northern Kabul neighborhood where a suicide bomber blew himself up just as voting was about to end, killing three people and wounding another 20, many of them seriously, said Dr Esa Hashemi who treated the injured at a nearby hospital.
Ahead of the elections, both the local so-called Islamic State affiliate and the Taliban threatened violence during elections, warning people to stay away from the polls.
The Taliban further warned teachers and students to not allow schools to be used as polling stations.
Instead, outside most polling stations there were lines of people waiting to mark their ballot.
As well as violence, the election was marred by chaos with key election workers failing to show up and many polling stations staying open hours later than scheduled to handle long lines of voters.
Problems surrounding the elections, which are already three years overdue, threaten to compromise the credibility of polls which an independent monitoring group said were also marred by incidences of ballot stuffing and intimidation by armed men affiliated with candidates in 19 of the country's 32 provinces.
Some areas have yet to vote, including Kandahar, where the provincial police chief was gunned down Thursday.
Stakes are high in the elections for Afghans who hope to reform Parliament, challenging the dominance of warlords and the politically corrupt and replacing them with a younger, more educated generation of politicians.
Afghanistan's deputy chief executive Mohammad Mohaqiq expressed outrage at the chaotic start to polling and assailed election preparation by the country's election commission.
"The people rushed like a flood to the polling stations, but the election commission employees were not present, and in some cases they were there but there were no electoral materials and in most cases the biometric systems was not working," he said.
"The widespread reports today of confusion and incompetence in the administration of the elections ... suggest that bureaucratic failures and lack of political will to prioritise organising credible parliamentary elections may do more to delegitimise the election results than threats and violent attacks by the Taliban and Daesh," said Andrew Wilder, vice-president of Asia Programs at the US Institute of Peace, using the Arabic acronym name for the Islamic State group.
Afghan President Ashraf Ghani marked his ballot at the start of voting.
In a televised speech afterward, he congratulated Afghans on another election and praised the security forces, particularly the air force, for getting ballots to Afghanistan's remotest corners.
"I thank you from the bottom of my heart," he said, also reminding those elected that they are there to serve the people and ensure the rule of law.
North of Kabul, thousands of outraged voters blocked a road after waiting more than five hours for a polling station to open, said Mohammad Azim, the governor of Qarabagh district where the demonstration took place.
Election Commission Commissioner Abdul Badi Sayat said dozens of teachers who had been trained in the new biometric system had not shown up for work at the polling stations. It wasn't clear whether that was related to a Taliban warning directed specifically at teachers and students telling them to stay away from the polls.
"The long lines at many polling stations today, despite the threats and violent attacks by the Taliban and Daesh, clearly demonstrate that the problem with Afghan elections is not the enthusiasm of Afghan voters for a democratic future," said Mr Wilder.
The Defence Ministry said it had increased its deployment of National Security Forces to 70,000 from the original 50,000 to protect polling stations.
The Independent Election Commission registered 8.8 million people.
Wasima Badghisy, a commission member, called voters "very, very brave" and said a turnout of five million would be a success.
At a polling station in crowded west Kabul, Khoda Baksh said he arrived nearly two hours early to cast his vote, dismissing Taliban threats of violence.
"We don't care about their threats. The Taliban are threatening us all the time," said 55-year-old Mr Baksh, who said he wanted to see a new generation of politicians take power in Afghanistan's 249-seat Parliament.
He bemoaned the current Parliament dominated by warlords and corrupt elite. "They have done zero for us."
In the run-up to the elections, two candidates were killed while polling in Kandahar was delayed for a week after a rogue guard gunned down the powerful provincial police chief, General Abdul Raziq.
In the capital of Kabul, security was tight, with police and military personnel stopping vehicles at dozens of checkpoints throughout the congested city.
Commission deputy spokesman Aziz Ibrahimi said results of Saturday's voting will not be released before mid-November and final results will not be out until later in December.