KABUL – Millions of Afghans defied threats Thursday to cast ballots in the country's second national elections since Taliban rule, but turnout appeared weaker this time because of continuing violence, fear and disenchantment. In much of the Taliban's southern strongholds, many people did not dare to vote, bolstering the hopes of President Hamid Karzai's chief rival.

At least 26 people were killed in election-related violence, fewer than had been feared.

Officials began counting millions of ballots as soon as the polls closed at 5 p.m. after a one-hour extension. First preliminary results weren't expected for several days, and some major candidates were already alleging fraud.

A top election official, Zekria Barakzai, told The Associated Press that he estimated 40 to 50 percent of the country's 15 million registered voters cast ballots — far lower than the 70 percent who voted in the presidential election in 2004.

Nevertheless, many Afghans did vote, some at great risk to their lives. Many waited until midday to see whether the Taliban would carry through with threats to attack polling stations. Some proudly showed off the ink on their index fingers to prove they had voted.

"I know the security situation of my country is not good, but I have made my decision to come and cast my vote anyway," said Shukran Ahmad, 32, said as he waited at a polling center in western Kabul. "I wanted to be the first person to vote today in this polling center."

Authorities managed to open 6,202 polling centers — 95 percent of those planned, according to Barakzai.

The top U.N. official in the country, Kai Eide, said the election "seems to be working well," and NATO Secretary-General Anders Fogh Rasmussen hailed the balloting as "testimony to the determination of the Afghan people to build democracy."

International officials had predicted an imperfect election — Afghanistan's second-ever direct presidential vote — but expressed hope that Afghans would accept the outcome as legitimate, a key component of President Barack Obama's strategy for the war.

A low turnout and allegations of fraud could cast doubt over the legitimacy of the vote and raise fears that followers of defeated candidates may take to the streets like opposition supporters in neighboring Iran following June's contentious presidential ballot there.

Hours after the polls closed, the deputy campaign manager for Karzai's top challenger, former Foreign Minister Abdullah Abdullah, was alleging "very large scale" fraud in at least three of the country's 34 provinces where Karzai had been expected to run well but where turnout appeared low.

"The ballot boxes were stuffed and now we're investigating to see how big it was," Saleh Mohammad Registani told the AP. "We're going to work under electoral law. Overall, we are satisfied with the election, and we are optimistic about the result. But so far we don't know about the extent of the fraud."

Another presidential candidate, Ramazan Bashardost, who had 10 percent support in pre-election polls, said he washed off the supposedly indelible ink used to identify people who had already voted. He called on authorities to "immediately stop this election."

Fraud allegations aside, a low turnout in the ethnic Pashtun south would harm Karzai's re-election chances and boost the standing of Abdullah, who draws his strength from the Tajik minority. Turnout in the Tajik north appeared to be stronger, a good sign for Abdullah.

Karzai, a Pashtun tribal leader who has held power since a U.S.-led invasion ousted the Taliban in late 2001 by a U.S.-led invasion, was favored to finish first among 36 official candidates. A strong showing by Abdullah could force a runoff if no one wins more than 50 percent.

The election was carried out despite Taliban threats to disrupt the vote and punish those who took part in "this American process."

Karzai said militants carried out 73 election day attacks in 15 provinces — a 50 percent increase over recent days, according to NATO figures. Karzai's ministers of defense and interior said attacks killed eight Afghan soldiers, nine police and nine civilians. A U.S. service member died in a mortar attack in the east Thursday, bringing to at least 33 the number of U.S. troops killed this month.

In Kabul, security companies reported at least five bomb attacks, and police exchanged fire for more than an hour with a group of armed men. Police said two suicide bombers died in the clash, police said.

Those militant attacks did not rise to the level that officials had feared, in part because of stringent security measures taken by Afghan forces and their U.S. and NATO allies.

Nevertheless, the Taliban pre-election campaign of intimidation seemed to dampen turnout, especially in areas where the extremists are strongest.

An election official in Kandahar, the south's largest city and the Taliban's spiritual birthplace, said turnout there appeared to be 40 percent lower than in the 2004 election. The official asked not to be identified because he wasn't authorized to release turnout figures.

An AP reporter in southern Helmand province, where thousands of U.S. and British troops are battling the Taliban partly to make it safe to vote, said turnout was also modest. More than 20 rockets struck the Helmand capital of Lashkar Gah, including one near a line of voters that killed a child.

Journalists also reported lower turnouts in Kabul than during the 2004 election. Many shopkeepers shuttered their stores, and relatively few private vehicles were seen on the capital's streets.

U.S. officials had hoped for a wide turnout as a symbolic rejection of the insurgency. The voting was seen partly as a test of the ability of U.S. forces to protect civilians — the new top military priority — and the willingness of voters to accept that help.

The Foreign Ministry asked news organizations to avoid "broadcasting any incidence of violence" during voting, and Afghan officials appeared reluctant to confirm violence, but the order did not significantly affect the flow of information during the day.

The next president will lead a nation plagued by armed insurgency, drugs, corruption and a feeble government. Violence has risen sharply in Afghanistan in the last three years, and the U.S. now has more than 60,000 forces in the country.

Some of the lower turnout may have stemmed from public disillusionment with politics after years of corruption, sluggish economy, poverty and rising violence. Karzai won his first regular term in 2004 with 55 percent of the vote, riding a wave of public optimism.

Instead of progress, the country slipped into a steep decline as a corruption, opium poppy production and violence increased.