KABUL — Millions of Afghans turned out for a second time on Saturday to elect a successor to President Hamid Karzai on Saturday, a decisive test of the country's ambitions to transfer power democratically for the first time in its tumultuous history. Most foreign troops will leave by the end of 2014, and whoever takes over from Karzai will inherit a troubled country plagued by an assertive Taliban insurgency and an economy crippled by corruption and the weak rule of law. The run-off pitted former anti-Taliban fighter Abdullah Abdullah against ex-World Bank economist Ashraf Ghani after neither secured the 50 percent majority needed to win outright in the first round on April 5. While violence spiked on the day with at least 20 civilians reported dead and a further 16 security force members killed in clashes with militants, the interior ministry said, the high-profile attacks that had been feared did not materialize. Voting ended at 4 p.m. (1130 GMT) with a palpable sense of relief in the Afghan capital. “I'm from this country so I am never afraid of threats,” said Lajiullah Azizi, a hospital worker who voted in western Kabul just minutes after a small bomb exploded at his polling station. “I hope this election will bring peace.” Officials immediately began counting ballots, although Afghanistan's difficult terrain, where ballot boxes have to hauled by donkey from some of its remotest corners, means preliminary results will not be known until July 2. Karzai, standing down after 12 years in power, is certain to retain a hand in politics but has been tight-lipped about his plans. “Today Afghanistan takes a step towards stability, development and peace. Come out and determine your destiny,” Karzai, clad in his trademark green Afghan robe, said after casting his ballot. Karzai's relationship with the West has deteriorated sharply over his refusal to sign a security pact with the United States allowing a small contingent of US forces to remain in the country beyond 2014. Both Abdullah and Ghani have promised to sign it promptly. “Looking ahead, the United States stands ready to work with the next president of Afghanistan,” the US ambassador to Afghanistan, James B. Cunningham, said in a statement. “Today marks the start of a new era for Afghanistan, and Afghans can be proud of what they have achieved.” Despite the outbreaks of violence, voters defied threats and long queues snaked out of polling centers in urban areas soon after voting began at 7 a.m. Turnout was more than seven million, election commission chief Ahmad Yousuf Nuristani said. The turnout was so high that some 333 voting centers ran out of ballot papers, sparking minor protests by disgruntled voters. The election commission said additional materials were later distributed and calm was restored. — Reuters