A plot by the Taliban to carry out a “Mumbai-style” attack, using teams of gunmen to hit multiple targets in Kabul, was thwarted just before Afghanistan’s presidential election, according to senior government officials.

Around 14 insurgents were arrested, they said, and significant quantities of guns and explosives discovered in a series of raids in the capital after an intelligence breakthrough that led to weeks of surveillance.

The Taliban made repeated threats about the election held on Saturday, and warned people that any attempt to vote would lead to them facing attacks – demanding they stay at home instead. One of the messages said “take your shrouds with you” if going to the polling stations.

The spate of attacks has risen significantly since Donald Trump ended talks being held between the US and the Taliban in Qatar. He announced his decision after an American soldier was killed by a Taliban bomb last month.

Bombings, shootings, mortar and rocket launches took place for 48 hours in the run-up to the vote, with explosions in Kabul and the cities of Kandahar and Jalalabad.

Afghanistan: Between Hope and Fear Show all 16 1 /16 Afghanistan: Between Hope and Fear Afghanistan: Between Hope and Fear 2001 Afghans at the Killi Faizo refugee camp desperately reach for bags of rice being handed out to the thousands who escaped the bombardment in southern Afghanistan during Operation Enduring Freedom. (Chaman, Pakistan, December 4, 2001) Paula Bronstein Afghanistan: Between Hope and Fear 2002 Mahbooba stands against a bullet-ridden wall, waiting to be seen at a medical clinic. The seven-year-old girl suffers from leishmaniasis, a parasitical infection. (Kabul, March 1, 2002) All photos Paula Bronstein Afghanistan: Between Hope and Fear 2003 A mother and her two children look out from their cave dwelling. Many families who, fleeing the Taliban, took refuge inside caves adjacent to Bamiyan’s destroyed ancient Buddha statues now have nowhere else to live. (Bamiyan, November 19, 2003) Paula Bronstein Afghanistan: Between Hope and Fear 2007 Students recite prayers in a makeshift outdoor classroom in the Wakhan Corridor, a mountainous region in northeastern Afghanistan that extends to China and separates Tajikistan from India and Pakistan. (Northeastern Afghanistan, September 2, 2007) Paula Bronstein Afghanistan: Between Hope and Fear 2007 Bodybuilders in the 55-60 kg category square off during a regional bodybuilding competition. Many Afghan men, like others around the world, feel that a macho image of physical strength is important. (Kabul, August 6, 2007) Paula Bronstein Afghanistan: Between Hope and Fear 2008 A woman in a white burqa enjoys an afternoon with her family feeding the white pigeons at the Blue Mosque. (Mazar-e-Sharif, March 8, 2008) Paula Bronstein Afghanistan: Between Hope and Fear 2009 Addicts inject heroin while trying to keep warm inside the abandoned Russian Cultural Center, which the capital city’s addicts use as a common gathering point. Heroin is readily available, costing about one dollar a hit. (Kabul, February 9, 2009) Paula Bronstein Afghanistan: Between Hope and Fear 2009 An elderly man holds his granddaughter in their tent at a refugee camp after they were forced to flee their village, which US and NATO forces had bombed because, they claimed, it was a Taliban hideout. (Surobi, Nangarhar Province, February 7, 2009) Paula Bronstein Afghanistan: Between Hope and Fear 2009 Seven-year-old Attiullah, a patient at Mirwais Hospital, stands alongside an X ray showing the bullet that entered his back, nearly killing him. Attiullah was shot by US forces when he was caught in a crossfire as he was herding sheep. (Kandahar, October 13, 2009). Paula Bronstein Afghanistan: Between Hope and Fear 2010 US Army Sargeant Jay Kenney (right), with Task Force Destiny, helps wounded Afghan National Army soldiers exit a Blackhawk helicopter after they have been rescued in an air mission. (Kandahar, December 12, 2010) Paula Bronstein Afghanistan: Between Hope and Fear 2010 An Afghan National Army battalion marches back to barracks at the Kabul Military Training Center. (Kabul, October 4, 2010) Paula Bronstein Afghanistan: Between Hope and Fear 2014 Eid Muhammad, seventy, lives in a house with a view overlooking the hills of Kabul. He and millions of other Afghans occupy land and housing without possessing formal deeds to them. (Kabul, November 21, 2014) Paula Bronstein Afghanistan: Between Hope and Fear 2014 Razima holds her two-year-old son, Malik, while waiting for medical attention at the Boost Hospital emergency room. (Lashkar Gah, Helmand Province, June 23, 2014) Paula Bronstein Afghanistan: Between Hope and Fear 2014 Young women cheer as they attend a rally for the Afghan presidential candidate Ashraf Ghani. (Kabul, April 1, 2014) Paula Bronstein Afghanistan: Between Hope and Fear 2014 Burqa-clad women wait to vote after a polling station runs out of ballots. (Kabul, April 5, 2014) Paula Bronstein Afghanistan: Between Hope and Fear 2015 Relatives, friends, and women’s rights activists grieve at the home of Farkhunda Malikzada, who was killed by a mob in the center of Kabul. Farkhunda was violently beaten and set on fire after a local cleric accused her of burning a Qur’an. (Kabul, March 22, 2015) Paula Bronstein

Security forces recorded 273 violent incidents, 91 of which were directed at voting centres. Government officials stated that 29 soldiers and police officers had died and 79 insurgents were killed.

The Taliban claimed to have carried out 530 attacks across the country, most of which, they said, were successful without providing further details.

But the “spectacular” operation that the Taliban were promising, with Kabul the prime target, did not happen. The capital has been repeatedly hit by suicide bombers in recent months but did not experience a major attack on the day.

Hamdullah Mohib, the national security adviser to the Afghan government, said: “They were certainly planning something very big. It would have been a huge propaganda victory for them with all the international interest in Afghanistan because of the election.

“But with a combination of very good intelligence, hard work and a bit of luck we managed to stop it in time.

“Piecing it all together, it seems they had come into Kabul in small numbers and set up bases. We believe the plan was to seize a government building, or perhaps somewhere where foreigners were located, and then carry out other attacks in the city. You can imagine what we would have been facing if that happened.”

Mr Mohib continued: “We have been tracking them for a while and had to be patient. We didn’t want to move in too soon and waited until they were in place, and then we carried out our move.”

An official from a western country with troops deployed in Afghanistan said: “We thought it was a pretty impressive security operation on the days around the election, especially after a pretty bad suicide attack a week before.

“Coordinated multiple attacks with a possible siege-type situation, if that’s what they were planning, are very tricky to deal with, as we have seen in Mumbai and Paris. There are allied forces on standby, but it must be stressed that the Afghans lead missions themselves.”

Late-night Taliban suicide attack in Kabul hours after US agrees deal to withdraw 5,000 troops from Afghanistan

Fear of violence, however, led to many people avoiding the polling stations and a low voter turnout. Initial estimates released by the Independent Election Commission showed that less than 25 per cent of the 9.6 million people who had registered to vote had actually done so.

Final figures confirming the estimate will mean the lowest turnout in Afghan elections since the fall of the Taliban regime in 2001. All three previous polls drew more voters, with around 60 per cent of the 12 million registered voters turning out at the last election in 2014.

More than a dozen candidates are taking part in the election, with the incumbent president, Ashraf Ghani, and his co-leader in the outgoing administration, Abdullah Abdullah, the main contenders.

Preliminary results are due by 19 October and the final result by 7 November. A second round would be held between the top two candidates if there is no overall winner.

Previous Afghan elections since the fall of the Taliban have been mired in allegations of fraud, and there have been accusations that the result will be “fixed” this time as well.

The election commission claims that the use of biometric verification will prevent ballot-rigging. Every polling station has been supplied with equipment which will match fingerprint and photographs to identity cards.

Some of the opposition candidates also maintain that a low turnout is a blow to the legitimacy of the election and will put into question the credibility of the winner.

But this view is not necessarily reflected among the public. Laibma Zahed, a teacher and an election supervisor at one of the polling stations, Zarghuna High School, wanted to point out: “People are coming to vote despite all the threats, young and old, women and men, and their voices must be heard. It’s up to everyone to decide for themselves if they vote or not.”

Syed Ibrahimi, a 48-year-old businessman, agreed: “I didn’t vote personally: maybe I should have done, but I didn’t. I have a wife and four children and I could not take the risk.”