Polls have closed in Afghanistan’s presidential election amid widespread complaints of irregularities and pockets of violence from Taliban insurgents, mostly in the south and north of the country.

Afghans heading to the polls complained that voters’ lists were incomplete or missing, and biometric identification machines intended to reduce fraud were not working properly, with officials not adequately trained on how to use them.

A bomb attack on a polling station in Kandahar left 15 people injured, three critically, amid reports of sporadic violence as the Taliban pledged to disrupt proceedings.

Afghan president Ashraf Ghani casts his vote. Credit: AP

A deeply flawed election could drive the country into chaos.

Ruhollah Nawroz, a representative of the Independent Complaints Commission tasked with monitoring the process, said the problems have been seen across the country.

Mr Nawroz said he arrived at a polling centre in the Taimani area of the capital Kabul at 6am, and “hour by hour I was facing problems”.

Polls opened at 7am local time and closed at 5pm (1.30pm BST) after the Independent Election Commission (IEC) extended polling by one hour.

Preliminary results will not be released until October 17, with a final vote count on November 7.

If no candidate wins 51% of the vote, a second round will be held between the two leading candidates.

Afghan men line up to cast their votes inside a polling station in Kabul. Credit: AP

The leading contenders are incumbent president Ashraf Ghani and his partner in the five-year-old unity government, Abdullah Abdullah, who has alleged abuse of powers by his opponent.

Cameras crowded both men as they cast their vote earlier in Kabul, with Mr Ghani telling voters they too had a responsibility to call out instances of fraud.

In Kabul, turnout was sporadic and in the morning hours it was rare to see a crowded polling centre. Afghans who had patiently lined up before the voting centres were opened, entered in some locations to find that election officials had yet to arrive by opening time.

Imam Baksh, who works as a security guard, said he was not worried about his safety as he stood waiting to mark his ballot, wondering whom he would vote for.

“All of them have been so disappointing for our country,” he said.

The government’s push to hold the vote was in itself controversial. In an interview with the Associated Press last week, former Afghan president Hamid Karzai, who still wields heavy influence, warned that the vote could be destabilising for the country at a time of deep political uncertainty and hinder restarting the peace process with the Taliban.

Presidential candidate Abdullah Abdullah. Credit: AP

On Saturday, one of the first reports of violence came from southern Afghanistan, the former spiritual heartland of the Taliban.

A bomb attack on a Kandahar mosque where a polling station was located injured 15 people, a doctor at the city’s main hospital said.

The wounded included a police officer and several election officials, along with voters. Three people are in a critical condition.

In northern Kunduz, where Taliban have previously threatened the city – even briefly taking control of some areas – insurgents fired mortar rounds into the municipality and attacked Afghan security forces on its outskirts, a council spokesman said.

He said ongoing fighting has wounded as many as 40 people.

Tens of thousands of police, intelligence officials and Afghan National Army personnel were deployed throughout the country to protect the 4,942 election centres.

Authorities said 431 polling stations will stay closed because it was impossible to guarantee their security since they were either in areas under Taliban control or where insurgents could threaten nearby villages.

An Afghan woman shows her inked finger after casting her vote. Credit: AP

Campaigning for the poll was subdued, but went into high gear barely two weeks ahead of the polls as most of the 18 presidential candidates expected a deal between the United States and the Taliban to delay the vote.

On September 7, US president Donald Trump declared a deal that seemed imminent dead after violent attacks in Kabul killed 12 people, including two US-led coalition soldiers, one of whom was American.

While many of the presidential candidates withdrew from the election, none formally did so, leaving all 18 candidates on the ballot.

Elections in Afghanistan are notoriously flawed and in the last presidential polls in 2014, allegations of widespread corruption were so massive that the United States intervened to prevent violence.

No winner was declared and the US put together the unity government in which Mr Ghani and Mr Abdullah shared equal power, with Mr Ghani as president and Mr Abdullah as chief executive.

Constant bickering and infighting within the government frustrated attempts to bring in substantive legislation as security, which has been tenuous, continued to deteriorate, frustrating Afghans and causing many to flee as refugees.