KABUL — Defying threats by the Taliban, Afghans turned up at polling stations across the country to vote in the country’s landmark presidential election Saturday, which appeared to unfold relatively smoothly despite a string of deadly attacks and allegations of fraud.
The day began somewhat ominously in Kabul as a handful of rockets detonated without causing significant damage shortly before polling stations opened and a slight tremor shook the earth as voters began lining up to cast ballots.
‘‘I’m enthusiastic,’’ Mohamed Anwar, 61, said as he left a polling station in Kabul Saturday morning, his finger stained by indelible ink. ‘‘Most people are eager to vote.’’
The contest between former foreign minister Abdullah Abdullah and former finance minister Ashraf Ghani has the potential to mark the first peaceful handover of power in Afghanistan’s history if it is not marred by a disputed result or widespread violence.
A credible election would go a long way to enable the United States to wind up its combat mission here by the end of the year and keep a residual force — as well as sustained financial aid — for years to come.
Officials said preliminary results are to be announced July 2, with final results due July 22.
In Paktia province in eastern Afghanistan, insurgents began firing rockets Friday night in an apparent attempt to intimidate voters, said General Mohammad Yaftali, the commander of the army’s 203d corps.
‘‘They’ve been shooting rockets and mortars since last night, trying to create fear so people don’t vote,’’ he said.
General Dawlat Waziri, the commander of the Afghan Army’s 201 Corps, said 16 people were killed in clashes on election day in the seven provinces his unit oversees. Most were soldiers, he said.
The scope of the violence around the country and its impact on the election could not be ascertained. It has been hard to promptly determine the level of bloodshed during previous Afghan elections because reports from remote parts of the country are often slow to trickle in.
Some polling stations in the east were shut down because of fighting, but officials said they could reopen later in the day.
Still, US officials expressed optimism that violence wouldn’t be the dominant theme of the historic day.
‘‘I think security will not be the issue today, but, as you sense it, the potential for fraud,’’ Major General Stephen Townsend, the top US commander in eastern Afghanistan, told a senior Afghan commander.
Observers working for the Abdullah campaign in Kabul reported instances of fraud at a couple of polling stations. At one voting site, observers and election commission officials got into a shouting match after an election official was reportedly seen telling elderly men whom to vote for.
‘‘This is a serious problem,’’ Abdullah observer Shuresh Saleh said. ‘‘The guy working for the election commission is telling people to vote for Ashraf Ghani.’’
The poll worker was allowed back into his polling station after receiving a warning.
Sayed Yasen, a 23-year-old journalist from Ghor province, said he expected that at least 20 percent of ballots counted in the election would be fraudulent. But he said that was a tolerable percentage for a country with entrenched corruption and a young democracy.
Wearing a suit and a black and red tie, Yasen arrived at his polling station carrying photos of his bloodied face — the result, he said, of an assault by members of the Taliban who were displeased by an article he wrote. Voting gives him slight hope that the incoming government will manage to strengthen the state’s authority outside the capital, he said.
‘‘I’m hopeful the situation will improve,’’ he said. ‘‘If not, we’ll have a return to warlordism, which will mean chaos.’’
At a polling station across town, Farouq Azam said most Afghans recognize that electing a new president will not fix the problems of a country beset by an entrenched insurgency, an anemic economy and ebbing Western aid. ‘‘People are hopeful, but they don’t think there will be much change,’’ he said.
In Helmand province, voter turnout appeared to be lower than during the first round in early April, said a tribal elder in Marjah district.
Abdul Wali Ahmadzai, the head of the provincial council in Logar province in eastern Afghanistan, said turnout was low during the morning but picked up later in the day.
‘‘Considering the Taliban threats in the morning, people feared to come out of their homes earlier to cast their votes, but later when they understood security was good, they headed to polling stations,’’ he said.