Presidential candidate Ramazan Bashardost was on a routine campaign stop in the eastern Afghan city of Khowst one day last month when he heard a thunderous explosion. Then another. And another.
"It was very loud, and pretty close, and I of course understood right away what was happening," said Bashardost, one of nearly 40 contenders in the Aug. 20 presidential vote.
On that day, insurgents had attacked Khowst's provincial police headquarters and several other sites, triggering hours of chaotic street fighting. Like most people in town, Bashardost was forced to lie low for the rest of the afternoon. He finally slipped away at nightfall.
In this wartime election season, having Taliban gunmen and suicide bombers as campaign trail companions isn't particularly unusual. Assassination fears, insurgent threats, travel dangers, intimidation of candidates, especially the female ones -- all conspire to make the vote an exercise in peril.
The security problems exacerbate already-daunting logistical complications in a country where road conditions are so poor and many districts so remote that a 3,000-strong donkey corps has been deployed to deliver ballots.
Western observers say the unsafe environment increases the chances of large-scale voting irregularities, in part because violence may keep election observers away from some sensitive locales. Nine campaign workers have been killed in preelection violence. And Taliban fighters have sought to unnerve voters with attacks close to the capital, Kabul, including an assault Monday on government buildings in nearby Lowgar province that killed at least five people.
Nonetheless, Afghan authorities express confidence that voters will go to the polls in sufficient numbers to ensure a credible result in both presidential and provincial assembly races, even though election officials have said that insurgent activity could prevent up to 10% of polling stations from opening.
"Enemies of the country want to stop people from voting, but we are watching vulnerable points and trying to prevent attacks. This is imperative," Interior Ministry spokesman Zemeri Bashary said. "This election is one of the important moments in our history."
Afghanistan's only previous presidential election, in 2004, was overseen by the occupying Western powers. This time around, Afghan officials are taking the lead role, though the $225-million cost is being borne almost entirely by the international community.
A rapid American troop buildup this summer and a major U.S. offensive in Afghanistan's south were spurred in part by determination to ensure the vote could take place safely. But American and other foreign troops will deliberately refrain from being a too-overt presence on the day of the balloting.
"We will not be the first line of defense," said Navy Rear Adm. Gregory Smith, the chief spokesman for Army Gen. Stanley McChrystal, the commander of Western forces in Afghanistan. Afghan police will guard polling stations, with Afghan soldiers manning checkpoints, he said. International forces will keep their distance from polling centers, standing by primarily as a quick-response force in case of trouble.
In many races, security fears have put a distinct damper on campaigning. That is particularly true out in the hinterlands, where candidates for provincial assemblies tend to invite small groups of backers to private homes -- fine for cementing an existing base of support, they say, but of little use in wooing new votes.
Bilquis Roshan, a provincial council member in Farah who is running for reelection, says that in the 2004 campaign, she traveled the length and breadth of her far-flung western province, often simply turning up and introducing herself. People would invite her home for meals, and with Afghanistan's indefatigable tradition of hospitality, such a visit might last days.
This time around, with the Taliban menacing the outskirts of the provincial capital, Roshan counted herself lucky to have been able to make brief campaign appearances in her home village, just four miles away.
She brushed aside warnings from conservative local clerics who told her she was offending Islam by displaying herself publicly and should stay home. But because of the threats, she traveled under guard, something she said she found both personally distasteful and an obstacle to connecting with constituents.
"It's just very, very difficult for a woman to campaign," Roshan said.
Leading presidential candidates have demonstrated differing philosophies about the security risk. Abdullah Abdullah, the main rival to President Hamid Karzai, has campaigned all over the country, often appearing at large rallies where crowds come and go with only cursory security checks.
"My own safety is not something I am spending time thinking about," Abdullah said, though he travels with a large contingent of bodyguards.
Karzai, who has survived several assassination attempts during his tenure, has attended only a few campaign rallies, all with handpicked audiences. Aides say he intends to step up his schedule of public appearances as election day draws closer.
At a rally Friday in the capital, Karzai urged backers from the Hazara ethnic group to ignore insurgents' warnings against going to the polls.
"God willing, everything will go safely," he said.
Taliban commanders have not directly threatened to attack polling places, though they have urged people to stay home and have said roads will be "blocked." It's not clear whether they meant roads near polling places would be seeded with homemade bombs, a practice that already claims the lives of civilians and Afghan and Western security forces almost daily.
The danger is most acute in remote provinces where fighting has intensified in recent months. Mohammad Omar, the governor of the northeastern province of Kunduz, took advantage of a recent visit by McChrystal to plead for more Afghan police to help ensure election safety. Of 216 polling stations, he said, 24 were likely to stay shuttered on the day of the vote.
"The Taliban wants to destabilize this area in connection with the election," he told the general.
Analysts point out that there is ample precedent for national elections taking place in conflict zones. But violence -- or fear of it -- is bound to skew the result to some extent.
"It can be done, definitely," said Seth Jones, an Afghanistan expert with the Rand Corp. "It just can't be done perfectly."