KABUL, Afghanistan — Despite a Taliban threat to stay away, Afghans lined up Saturday to vote in a presidential runoff between two candidates who both promise to improve ties with the West and combat corruption as they confront a powerful Taliban insurgency and preside over the withdrawal of most foreign troops by the end of the year.
Whoever wins faces major challenges in trying to bolster Afghanistan’s security forces against a relentless insurgency and improving the nation’s economy and infrastructure at a time when international aid for Afghanistan is drying up. But many said just holding the country’s first peaceful transfer of authority was a major success.
The presidential hopefuls —former foreign minister Abdullah Abdullah and ex-World Bank official and former finance minister Ashraf Ghani Ahmadzai — differ more in personality in policy. Both have promised to sign a long-delayed security pact with the United States. That would allow nearly 10,000 American troops to remain in the country for two more years to conduct counterterrorism operations and continue training and advising the ill-prepared Afghan army and police.
‘‘I voted today for my future, because it is still not clear — the country is at war and corruption is everywhere and security is terrible. I want the next president to bring security above all and jobs,’’ said 20-year-old Marya Nazami, who voted for Ahmadzai.
The Taliban intensified attacks ahead of the vote and warned people to stay away from the polls, but the Islamic militants failed to disrupthe first round on April 5 and security forces launched a massive operation. Troops frisked voters before allowing them into polling stations and erected checkpoints around the capital of Kabul to search cars for explosives or other weapons. Trucks also were banned from the city.
Still, the militants made their presence known. A series of rockets slammed into areas in the eastern Khost province, near the Pakistani border, killing six civilians and wounding eight, according to provincial government spokesman Mubarez Mohammad Zadran. Elsewhere in the east, a mortar shell killed two other civilians and wounded three in Logar province. Several other explosions were reported in Kabul and elsewhere, but those caused no casualties.
President Hamid Karzai, who has grown increasingly alienated from his one-time US allies during his two terms in office, has refused to sign the pact.
Many voters said they were eager to get the bilateral security agreement signed after watching Islamic extremists seize large sections of Iraq nearly three years after US troops withdrew from that country. Iraq’s Shiite-led government had discussed with the Americans the possibility of a residual US force but the two sides were unable to reach an agreement.
‘‘Iraq is burning,’’ Abbas Razaye, a 36-year-old shopkeeper, said after voting in a mosque in western Kabul. ‘‘We need the foreign troops for the time being. Otherwise our history of civil war will repeat itself and Afghanistan will deteriorate even more than Iraq.’’
Sayed Qayyum, 58, agreed the pact should be signed. ‘‘I am afraid if it isn’t signed then Afghanistan will face the same fate as Iraq,’’ he said.
Abdullah and Ahmadzai were facing off after none of the eight candidates in the first round won the majority needed to avoid a second round. Abdullah emerged as the front-runner after he garnered 45 percent of votes in the initial balloting; Ahmadzai was second with 31.6 percent. The two have since campaigned as much for the support from their six former rivals as from Afghans themselves.
Abdul Hakim, a 25-year-old businessman, said he voted for Abdullah in both elections, and he has high expectations.
‘‘I want Abdullah to remove corruption and poppy cultivation and bring security. He should definitely sign the BSA,’’ he said. ‘‘Afghanistan has no economy. Afghanistan has very bad security.’’
With Karzai out of the race, Ahmadzai has gained the support of many Pashtuns who voted against him five years ago, particularly in the Taliban heartland in southern Afghanistan.
‘‘According to our will, Ashraf Ghani is the best candidate and the rightful leader of our country,’’ said Abdul Saboor Zamaria, a 30-year-old working for a nongovernmental organization in the southern city of Kandahar. ‘‘If Abdullah Abdullah is made our leader more mistrust and rage will spread in our country and violence will keep increasing day by day.’’
Unlike the previous round, when long lines and ballot shortages prompted authorities to extend the voting, polls closed on schedule at 4 p.m. (1130 GMT, 7:30 a.m. EDT.) Official preliminary results to be announced on July 2, final on July 22. Interior Minister Mohammad Umar Daudzai said that in all, around 150 attacks were recorded, including rockets, roadside bombs and gunbattles.
Karzai, who has led the country since the US invasion toppled the Taliban in the months after the Sep. 11, 2001 attacks but was constitutionally barred from seeking a third term, cast his ballot at a high school near the presidential palace.
‘‘Today your vote will lead Afghanistan toward a better future, better government and a better life,’’ he said to his countrymen. ‘‘Afghanistan is taking another step forward in a transition toward security, progress and stability.’’
Abdullah, 53, whose mother was a Tajik, draws his support mainly from that ethnicity although his father was Pashtun. During the Soviet occupation of Afghanistan, he served as adviser to and spokesman for Tajik warlord Ahmad Shah Massoud, who was assassinated by al-Qaida two days before the Sept. 11, 2001 attacks.
Later that year, Abdullah became the face of Afghanistan’s anti-Taliban movement after the US toppled the Taliban regime, giving frequent press conferences to international media. He served as foreign minister and then was the runner-up in Karzai’s disputed re-election in 2009.
‘‘We promise the people of Afghanistan that their future ... is assured with our team, which is a team from the people of Afghanistan, for the people of Afghanistan and for the future of this country,’’ Abdullah said, flashing his finger stained with indelible ink used to prevent multiple voting.
Ahmadzai, a 64-year-old Pashtun, received a Ph.D. in anthropology from Columbia University, taught at Johns Hopkins University and worked at the World Bank. He gave up US citizenship to run in the 2009 election, but received only 3 percent of the vote.
‘‘These fingers, which used to fire the trigger of guns, now are being used to vote. We ask all the armed oppositions to allow the nation to choose its future,’’ he said Saturday.Khan reported from Kandahar. Associated Press writer Rahim Faiez in Kabul contributed to this report.