Nobody I talked to in Afghanistan last week wants a return to Taliban rule. Afghans cherish the opportunity to live a life of their own choosing and the chance to govern themselves. But Afghans fear an enduring stalemate. The Taliban are too weak to fight Afghan and coalition forces in conventional confrontation. But Afghan institutions are not yet sufficiently rooted to drive out the Taliban's guerrilla warfare. It is in this context that we welcome President Obama's decision to deploy a further 17,000 troops to Afghanistan. The threat of terrorist attack on our soil remains real. Afghanistan was terrorism's incubator of choice in the 1990s and its borders with Pakistan remains so today. Al Qaeda is still hiding on these borders, co-opting the Taliban and tribesmen. The US commitment, alongside us and 40 other nations, is an important signal of their long-term determination. Our armed forces, diplomats and aid workers, operating in extraordinarily difficult terrain, continue to make a huge difference. Their unflinching courage and professionalism is a credit to this country. Over the past year in Helmand, they've helped double the number of districts under Afghan Government control. Opium cultivation is down, the legal Afghan economy is growing, and many more people have access to basic healthcare and schools. But as we have long argued, there is no purely military solution to the insurgency. Unless it is aligned with a clear political and economic strategy, military might will only force the Taliban further underground, or encourage them to play a waiting game. Defeating the insurgency means understanding it, and being clearer about the forms it takes. The insurgency is not drawn from a single organisation, nor is it fighting for a single cause. There are ideological Taliban, ten-dollar a day Taliban, fighters from beyond the region, criminals, narco-traffickers, warlords and wannabe powerbrokers. And all of them rely to some extent on the acquiescence of some ordinary citizens, who despite dreading the Taliban's return, doubt the capacity of the state to protect them, so hedge their bets. Our strategy is to help the Afghan government divide the insurgency, and co-opt those prepared to renounce Al-Qaeda, give up violence, and accept the Afghan Constitution. This means countering the full spectrum of insurgents in a range of different ways. If we want ordinary Afghans to deny the Taliban support and sanctuary, we need to give them confidence that their state will protect them. That is why we must build the capacity of the Afghan state - especially the National Army, the police and the judiciary - and help the government provide for its people. When it comes to those who have aligned themselves with the Taliban not for safety and lack of choice, but rather for power and influence, we need stronger incentives and sanctions. They need to know that if they renounce violence and accept the rule of law, there are opportunities for them to exercise influence through the legitimate political process. But if they do not accept the Afghan constitution, they will be pursued relentlessly by military forces. Then of course there are the more extreme elements of the insurgency; the hard-line ideologues who are determined to reject the authority of the legitimate state, and prepared to fight to the bitter end. And there are the small numbers of foreign fighters. For both these groups, the only response is confrontation and the power of force, of the coalition and increasingly the Afghan forces. There has in the last year been significant attrition in these groups' ranks on both sides of the border. On Wednesday I went to the Khyber Pass. The ease with which insurgents can move across the 2400km border between Afghanistan and Pakistan is a massive problem. American determination to look at Afghanistan and Pakistan together is a great step forward. With intimate connections between the insurgency in Kunar and the militancy in Waziristan, between the criminals, spoilers and terrorists in Lashkar Gah and Quetta, in Peshawar and Nangahar, Afghanistan can never be safe unless the Pakistani government successfully addresses the militancy in Pakistan. Out of the loss of life to terrorism in Pakistan, the danger of spreading Talibanisation, the summary executions and the school demolitions, is emerging a growing acceptance within Pakistan's elite that violent extremism is the greatest threat the country faces. We need to support the democratically elected government and its military forces in rooting out the extremism on its soil and developing a joint approach with the Afghan authorities. Afghanistan is a test of the resolve of NATO and the broader international alliance. More troops will never be enough to enforce stability across the whole country. But by pressuring those who refuse to cooperate with the Afghan state, and protecting those who do, military force can directly support a political solution. This is the only way to build a safe and secure Afghanistan. And it is the best way to ensure that the Taliban do not return to power, and that the country cannot, once again, become a haven for those who seek to do us harm. The Writer is the British Foreign Secretary