A five-day visit to Afghanistan left me profoundly pessimistic over the accomplishments to date, measured against the scale of international blood and treasure expended, yet convinced of the importance of not losing Afghanistan to the other side.

Kabul defined the pessimism: After more than seven years of massive security operations, travel in the capital city was permitted only in armoured cars while wearing bulletproof vests.

Bamiyan defined the determination not to abandon the fight: The gaping hillside holes that held two giant Buddha statues, silent sentinels for more than 1,500 years before the Taliban destroyed them in an act of willful cultural vandalism, stand in silent rebuke to the world's helplessness.

The two pressing priorities are to transform the Afghan mission from a military to a civilian operation and to shift it from an externally directed to a locally owned enterprise. At present, the capital and the country are fortified garrisons and Afghanistan is not merely under foreign occupation but feels quasi-colonized, with real power divided between the Afghan warlords and the American overlords.

Although most people expect Hamid Karzai to win the presidential election in August, few are enthused by the prospect of having him for five more years. One puzzle is whether the Taliban will take part in the political process, perhaps in preparation for next year's parliamentary elections. They could stay outside, waiting for the low-lying fruits of political victory to fall into their laps as the coterie around the President becomes increasingly more corrupt, powerless and ineffectual, and public cynicism and revulsion grow proportionately.

There is an ongoing agonizing debate over whether there are people who joined the Taliban for reasons other than ideological fanaticism and can be weaned from the path of militancy. Or will concessions and goodwill gestures of accommodation be seen as signs of weakness and serve merely to embolden the insurgency?

A second imponderable is whether Afghans will see the election as free and fair. There is some concern that the various tools in government hands will facilitate the manipulation of the machinery and process and compromise the integrity of the presidential election: the Afghan Independent Election Commission; the Afghan National Police; the provincial governors, district administrators and police commanders; the government's power of the purse; and a subservient media.

The reality of recent reversals on human rights, civil liberties and press freedoms is hard to miss. The passage of the notorious Shia law with its antediluvian views on the wifely duty to provide sex on tap for husbands is but one example; the jailing of journalists for entirely innocuous behaviour is another. Westerners will lose the will to fight in Afghanistan if they see the government's behaviour sliding to match the Taliban approach to governance, fatwa for fatwa.

A retreat from building the institutions of state could prove fatal to the cause of creating and leaving behind a stable polity and a sound economy. This includes strengthening the police, judicial and criminal-justice systems, instilling discipline and professionalism, paying adequate salaries so officials don't take bribes out of economic necessity as opposed to corrupt character, and accentuating a national, as opposed to sectarian, identity. The army needs to be built up into a professional and national force too. But history shows that to succeed, a counterinsurgency operation has to be led by the police, not the military.

The strengthened U.S. military presence and activity may be necessary, for no other country seems willing to take up the security slack. But it does come with a heightened risk of civilian casualties and culturally offensive behaviour. Just as there is a need to shift from a heavy military to a major civilian footprint, so at some stage the lead international actor should be the United Nations. For all its faults, the organization has no peer in nation-building.

The UN is also better placed to engage the necessary regional players, China, Russia, Iran, Pakistan and India. Insurgents cannot be defeated if they enjoy sanctuary in a neighbouring country. Afghanistan's battle space straddles the border with Pakistan. As long as Pakistan feeds on its paranoia of India being the greater existential threat, both Afghanistan and Pakistan will remain volatile.

Knowing what we do of Taliban rule in Afghanistan for many years, having been given a foretaste of what to expect in Pakistan if they manage to capture power (the stomach-churning video of the young woman being publicly flogged for immoral acts real or imagined), bearing in mind that Pakistan has nuclear weapons and mindful of the grave threat that a Taliban-ruled Pakistan would pose to India with its 150 million Muslims, the one option we do not have is to give up.

Ramesh Thakur is director of the Balsillie School of International Affairs in Waterloo, Ont.

The opinions expressed in this article/multimedia are those of the author(s) and do not necessarily reflect the views of CIGI or its Board of Directors.