(CNSNews.com) – Afghanistan’s presidential election, touted in advance as its first ever democratic and peaceful transition of power, looks set instead to deliver a verdict that could deeply divide the country just months before most U.S. troops are due to depart.

Preliminary results released by the Independent Election CommissionMonday pointed to a victory for Ashraf Ghani, but amid claims by rival Abdullah Abdullah of massive rigging, ballots from some 7,000 voting stations – almost one-third of the total – are to be recounted.

Secretary of State John Kerry, in a statement released as he traveled to China early Tuesday, said the U.S. expected Afghan authorities to investigate allegations of irregularities, but also warned against any attempts by people protesting the interim results to take matters into their own hands.

“I have noted reports of protests in Afghanistan and of suggestions of a ‘parallel government’ with the gravest concern,” Kerry said, adding that “there is no justifiable recourse to violence or threats of violence, or for resort to extra-constitutional measures or threats of the same.”

“We call on all Afghan leaders to maintain calm in order to preserve the gains of the last decade and maintain the trust of the Afghan people,” he said. “Any action to take power by extra-legal means will cost Afghanistan the financial and security support of the United States and the international community. “

Earlier, State Department spokeswoman Jen Psaki stressed that the results were “not final or authoritative and may not predict the final outcome.”

“Serious allegations of fraud” had not been sufficiently investigated, she told a briefing.

“So right now, our focus is on encouraging a full and thorough review of all reasonable allegations of irregularities,” Psaki added. “We think that’s essential to ensuring that the Afghan people have confidence in the integrity of the electoral process.”

The final results are due to be announced on July 22, and the successor to President Hamid Karzai is scheduled to take office on August 2.

The interim results for the June runoff vote gave Ghani around 56 percent to Abdullah’s 44 percent. In the first round, last April, Abdullah had won 45 percent and Ghani 31 percent in an eight-candidate race.

Abdullah, a former foreign minister who draws strong support from northern Afghanistan’s Tajik minority (comprising about 27 percent of the population), labeled the result a “coup” against the Afghan people. He had earlier accused election officials of fraud.

Ghani, a former World Bank economist, enjoys support from many ethnic Pashtuns (42 percent of the population) in the south and east.

Whatever the outcome of the recount process, a large number of voters will likely be left disgruntled. The uncertainty has many Afghans looking anxiously at Iraq, where two-and-a-half years after the last U.S. forces withdrew the country is riven by sectarian rivalries and facing what the U.S. calls an “existential” threat from Sunni jihadists.

Visiting Kabul over the Fourth of July weekend, U.S. Sens. John McCain (R-Ariz.) and Lindsey Graham (R-S.C.) stressed the importance of a credible election and an end to the political deadlock, and also pointed to the situation in Iraq.

In an editorial Tuesday the independent Daily Outlook Afghanistan said the senators’ message was an important one for Afghans, particularly given “the present scenario of Iraq where militants have succeeded in establishing their separate geographic entity and they are also trying to bring an end to the democratic government of Iraq.”

It lamented that in Iraq today, “all the economic and political gains that were the results of the efforts of international community for over a decade have been lost and country is again in its worst turmoil.”

While Iraq’s deepest divisions run along sectarian Sunni-Shi’ite lines, the primary concern in Afghanistan (which is 80 percent Sunni) would be that without a credible leadership in Kabul – and in the absence of a robust foreign military presence – the country could return to its former state of violent conflict among ethnic and tribal factions, possibly paving the way for a return of the Taliban.

‘Malicious ideology’

The election uncertainty also gives the Taliban ammunition in its propaganda campaign against the U.S., and Western democracy in general.

In a recent statement, the Taliban said the election had been conducted “under the direct control and financial support of the invading Americans and their allied forces in an atmosphere of invasion and deception.”

It described Western democracy as “a malicious ideology of some corrupt governments and malevolent individuals and nearly all the sufferings and afflictions inside the world are the offspring of this curse.”

The Taliban recalled that the Soviet Union and Britain had left Afghanistan after past invasions, and implied that once the U.S. has gone the country will be able to revert to the “pious Islamic system” of the past 1,400 years, and enjoy “the fruits and benevolences of this system.”

During the election campaign both Abdullah and Ghani pledged to sign a bilateral security agreement (BSA) negotiated with the U.S. government, but which Karzai refused to endorse despite it winning the approval of a gathering of tribal elders last November.

The BSA will govern any U.S. troop deployment beyond the Dec. 31, 2014 date for the termination of the NATO-led International Security Assistance Force mission.

President Obama last May announced his timetable for a post-2014 troop presence in Afghanistan: 9,800 troops at the beginning of next year, cut by around half a year later, and by the end of 2016 reduced again to leave only a “security assistance component,” attached to the U.S. Embassy in Kabul.

Speaking on CBS’s “Face the Nation” after returning from Afghanistan, McCain warned that Obama’s drawdown plans would repeat the mistake made in Iraq, where no troops remained after the end of 2011.

“The president is going to make the same mistake in Afghanistan, unless he reverses that decision that he made,” he said. “You're going to see the same result in Afghanistan.”