Americans seldom have reason to care deeply about election results in far away nations, but Saturday’s voting in Pakistan deserved closer-than-usual attention because that dangerously unstable nation looms large in our country’s foreign policy and is particularly critical to the scheduled end of the war in Afghanistan next year.

When the time comes to withdraw from Afghanistan, the safest and most efficient route would take American troops and equipment right through Pakistan. If an unfriendly government were in charge, conceivably that route could be shut off.

But there are even more important reasons why the United States wants a stable, friendly government in Pakistan. It is, after all, one of the few nations with nuclear capability, and it has a long history of bitter conflict with its nearest and largest neighbor, India.

The results of Saturday’s election would seem to please Washington because Nawaz Sharif managed to repel a major challenge from former cricket star Imran Khan, who had drawn strong support, especially from younger voters, to his call for a “new day” in Pakistani politics. His ideas were, to a degree, less friendly to the United States than Sharif’s.

Pakistan’s problems are many and varied (its economy is in deep trouble), and its often fragile alliance with Washington requires both governments to tread carefully lest that important relationship be sundered.

Sharif had been prime minister until 14 years ago, when he was overthrown and exiled by a military dictator. His Muslim League-Nawaz party (PML-N), was believed to have easily won a parliamentary majority of sufficient size to assure his return to office.

Khan’s new Pakistan Tehreek-e-Insaf (PTI) party reportedly captured only around 35 seats (compared to 110 for Sharif).That was a huge disappointment for his ardent supporters who had repeatedly vowed that a “tsunami” of votes for Khan would vanquish Pakistan’s established political parties.

More humiliating for the charismatic Khan was the fact he lost a seat he had personally campaigned for in Lahore. His victory was regarded as essential to his overall chances.

Of special significance is the fact that Saturday’s election was the first time in Pakistan’s history that one elected government will hand over power to another. In the past, the military had prevented consecutive civilian governments.

The election, not surprisingly, was marred by violence. At least 22 people were killed and reports of rampant vote rigging, particularly in Karachi, the country’s biggest city, were widespread. Khan’s supporters complained of blatant efforts to intimidate voters in two of Karachi’s more affluent neighborhoods where Khan was popular.

But the Taliban, which had threatened widespread havoc on election day (arguing that “democracy is not Islamic”), was not as large a factor as many had feared. Still, the Taliban isn’t going away. Its ruthless pursuit of its own radical interpretation of Islam remains a serious problem.

The role of the United States was part of the campaign, not because Americans will need safe paths out of Afghanistan when that conflict ends in 2014, but because voters of all political views are angry that American drones frequently have used Pakistani airspace to launch attacks on suspected jihadists, a practice that has cost many civilian lives (referred to by the United States military as regrettable “collateral damage”).

The White House may now need to recalibrate our nation’s relationship with Pakistan. As much as Americans may disapprove of the widespread corruption and the presence of so many anti-western radicals among Pakistan’s population, there’s no escaping the fact that the United States absolutely needs an ally in that strategically situated nation.