Updated

Afghans flocked to polling stations nationwide on Saturday, defying a threat of violence by the Taliban to cast ballots in what promises to be the nation's first democratic transfer of power.

Amid tight security, men in traditional tunics and loose trousers, and women covered in burqas lined up at polling centers more than an hour before they opened in Kabul and elsewhere.

Excitement was high as Afghans chose from a field of eight presidential candidates as well as provincial councils. With three men considered front-runners, nobody was expected to get the majority needed for an outright victory so a runoff was widely expected.

Hundreds of thousands of Afghan police and soldiers fanned out across the country, searching cars at checkpoints and blocking vehicles from getting close to polling stations. Some voters were searched three times in Kabul, and text messages were blocked in an apparent attempt to prevent candidates from last-minute campaigning.

On Friday, veteran Associated Press photographer Anja Niedringhaus was killed and AP reporter Kathy Gannon was wounded when an Afghan policeman opened fire while the two were sitting in their car in the eastern city of Khost. The two were at a security forces base, waiting to move in a convoy of election workers delivering ballots.

Niedringhaus, 48, an internationally acclaimed German photographer, was killed instantly, while Gannon, 60, was hospitalized in Kabul and is in stable condition.

President Hamid Karzai, who has led the country since the Taliban were ousted in 2001, is constitutionally barred from a third term. Karzai cast his ballot at a high school near the presidential palace.

"Today for us, the people of Afghanistan, is a very vital day that will determine our national future. We the people of Afghanistan will elect our provincial council members and our president by our secret votes," he said, his finger stained with the indelible ink used to prevent people from voting twice.

Karzai's tenure has been heavily criticized as he has failed to end the endemic corruption and poverty in the country, which remains mired in violence after nearly 13 years of war. As international combat forces prepare to withdraw by the end of this year, the country is so unstable that the very fact the crucial elections are being held is touted as one of Karzai's few successes.

The eventual winner faces deep challenges. Security forces will be left to deal with the Taliban insurgency without international troops. Billions of dollars in international aid are at risk with the coalition forces' withdrawal. Expectations are high among Afghans that the new leader will alleviate poverty and clean up the government in a country that Transparency International last year ranked among the three most corrupt in the world alongside Somalia and North Korea.

Mohammad Aleem Azizi, a 57-year-old shopkeeper, said he voted to re-elect Karzai in the last election in 2009 but has been disappointed.

"Security deteriorated, insecurity is getting worse day by day," he said. "I want peace and stability in this country. I hope the new president of Afghanistan will be a good person."

Nazia Azizi, a 40-year-old housewife, was first in line at a school in eastern Kabul.

"I have suffered so much from the fighting and I want prosperity and security in Afghanistan. That is why I have come here to cast my vote," she said. "I hope that the votes that we are casting will be counted and that there will be no fraud in this election."

The militants have vowed to disrupt the balloting by targeting polling centers and election workers. High-profile attacks in the heart of Kabul in the weeks ahead of voting were clearly designed to show they are capable of striking even in highly secured areas.

The Taliban's bloody campaign underlines the stakes of the election. If turnout is high even in dangerous areas and the Afghans are able to hold a successful vote, that could undermine the Taliban's appeal.

The race is also the first for Afghans in which the outcome is uncertain. Three men are considered top contenders — a major shift from past elections dominated by Karzai. None is expected to get a majority needed to secure a win outright, so a runoff between the top two vote getters is widely expected.

There do not appear to be major policy differences toward the West between the front-runners — Abdullah Abdullah, Karzai's top rival in the last election; Ashraf Ghani Ahmadzai, an academic and former World Bank official; and Zalmai Rassoul, a former foreign minister.

All have promised to sign a security agreement with the United States that will allow thousands of foreign troops to remain in the country after 2014 — which Karzai has refused to do. The candidates differ on some issues such as the country's border dispute with Pakistan. But all preach against fraud and corruption and vow to improve security.

Polls were due to close at 4 p.m. local time (1130 GMT), but a spokesman for the Independent Election Commission, Noor Mohammad Noor, said polling stations could be kept open on a case-by-case basis to allow everybody in line to vote.

Mohammad Daoud Sultanzai, another presidential candidate, said election day was a time for the Afghan people to raise their voice and play a role in making decisions about their country.

Sultanzai appeared on television with his wife at his side, a rare occurrence in a country where male and female voters are segregated.

"Today is a historical day for Afghanistan," his wife, Zohra, said. "It is a big honor that I have participated in this process and I ask all Afghan mothers, sisters and daughters to participate in this political process and have an active role in the election."

Women have played a more visible role in this election than in the past as concern is rising that women will lose much of the gains they have made after international forces withdraw, reducing the ability of the U.S. and other Western countries to pressure the government to work for equality.

Electoral officials have taken extra measures to prevent fraud after widespread vote-rigging in 2009 marred Karzai's re-election. Strict protocols include bar codes on the ballot boxes being delivered to nearly 6,500 polling centers in all 34 provinces and plans to tally the results immediately after the vote closes and post a copy of the results at each center.

___

Associated Press writer Kim Gamel contributed to this report.