(Adds latest incidents, recasts context and background)
By Hamid Shalizi and Jessica Donati
KABUL/KANDAHAR, Afghanistan, April 5 (Reuters) - Voting was largely peaceful in Afghanistan's presidential election on Saturday, with only isolated attacks on polling stations as a country racked by decades of chaos embarked on its first ever democratic transfer of power.
A roadside bomb killed two policemen and wounded two others in the southern city of Qalat as they were returning from a polling station, while four voters were wounded in an explosion at a voting centre in the southeastern province of Logar.
There were no reports of more serious attacks so far on an election that Taliban insurgents had vowed to derail, branding it a U.S.-backed sham.
The United States, having spent $90 billion on aid and training for Afghan security forces since it helped vanquish the Taliban in 2001, could point to its success promoting democracy as a major achievement toward leaving Afghanistan as a more stable country.
But the abiding Taliban threat, and uncertainty over neighbour Pakistan's intentions, leaves the worry that Afghanistan could enter a fresh cycle of violence, and once again become a haven for groups like al Qaeda, after the bulk of U.S. troops leave by the year-end.
Most people expect the election will be better run than the chaotic 2009 vote that handed the outgoing president, Hamid Karzai, a second term amid massive fraud and ballot stuffing.
The stronger the next president's mandate, the less vulnerable Afghanistan could be to instability. Even if the election is less flawed this time, it could take months - perhaps even until October - for a winner to be declared at a time when the country desperately needs a leader to stem rising violence as foreign troops prepare to leave.
Nearly 3,500 members of the U.S.-led coalition force have been killed in Afghanistan since deployment over a decade ago.
KABUL SEALED OFF
About 12 million are eligible to vote in the election, and there are eight candidates, with former foreign ministers Abdullah Abdullah and Zalmay Rassoul, and former finance minister Ashraf Ghani the favourites.
Karzai is barred by the constitution from running for the presidency again. But, after 12 years in power, he is widely expected to retain influence through politicians loyal to him.
The Taliban warned civilians ahead of the election they would be targeted if they try to vote, and dozens died in a spate of attacks in the preceding weeks.
A veteran Associated Press photographer was killed and a senior correspondent of the same news agency was wounded on Friday when a policeman opened fire on the two women in eastern Afghanistan as they reported on preparations for the poll.
More than 350,000 Afghan troops were deployed, guarding against attacks on polling stations and voters. The capital, Kabul, was sealed off by rings of roadblocks and checkpoints.
In the city of Kandahar, cradle of the Taliban insurgency, the mood was tense. Vehicles were not allowed to move on the roads and checkpoints were set up at every intersection.
Hamida, a 20-year-old teacher working at a Kandahar polling station, said more than a dozen women turned up in the first two hours of voting and added that she expected more to come despite the threat of an attack by the Taliban.
"We are trying not to think about it," she said, only her honey-brown eyes visible through her black niqab.
Raising questions about the legitimacy of the vote even before it began, the election commission announced that at least 10 percent of polling stations were expected to be shut due to security threats, and most foreign observers left Afghanistan in the wake of a deadly attack on a hotel in Kabul last month.
The interior ministry said six officials - including an intelligence agent - were detained on Saturday for trying to rig the vote, and elsewhere several people were arrested for trying to use fake voter cards.
RISK OF DELAY
One of the chief risks is the length of time it may take to declare a new president. If none of the candidates wins over 50 percent of the vote, the two frontrunners would go into a run-off on May 28, spinning out the process into the holy month of Ramadan when life slows to a crawl.
A long delay would leave little time to complete a pact between Kabul and Washington to keep up to 10,000 U.S. troops in the country beyond 2014, after the bulk of the American force, which currently stands at around 23,500, has pulled out.
Karzai has rejected the pact, but the three frontrunners have pledged to sign it. Without the pact, far weaker Afghan forces would be left on their own to fight the Taliban.
Uncertainty over the outcome could also stall crucial foreign aid and economic reform, foment ethnic tensions and leave a political vacuum in which the Taliban could gain ground.
The election is a landmark after 13 years of struggle to quell an insurgency that has killed at least 16,000 Afghan civilians and thousands more soldiers.
Karzai's relations with the United States became increasingly strained in recent years as Afghan casualties mounted, and he voiced frustrated that Washington was not putting enough pressure on Pakistan to stop the Taliban, who base themselves in borderlands.
Although Karzai's departure is a turning point for Afghanistan, none of his would-be successors would bring radical change, Western diplomats say.
"The only positive thing in this election is that it is necessary to save the state as it is, and therefore there is a need to transfer power one way or the other," Sarah Chayes, a South Asia expert at the Carnegie Endowment for International Peace told a media briefing on the eve of the vote.
"Whether the election will be the great transformative event that everybody expects is, I think, delusional." (Additional reporting by Mirwais Harooni in KABUL; Writing by John Chalmers; Editing by Simon Cameron-Moore)