Image caption The West hopes to hand over security to Afghan security forces by 2014

Guest columnist Ahmed Rashid says in the wake of the Wikileaks dossier, Western lawmakers must focus on ending the war in Afghanistan responsibly, with Pakistan's help, or risk setting the region aflame.

There have been doubts in the US and Europe about the war in Afghanistan and clamour for an even earlier withdrawal of international troops since the website Wikileaks released 90,000 leaked classified documents on the conflict.

In an extraordinary vote in the US Congress on 27 July to provide an additional $37bn (£23bn) for war funding, 114 members voted against.

They included 102 Democrats and for the first time 12 Republicans. Last year, just 32 Democrats opposed a similar mid-term bill.

In several European parliaments the mood is much the same.

However, Congress and European parliaments must not throw the baby out with the bath water.

Wikileaks have not provided anything new about the failures of the Afghan government, Pakistani or Iranian links to the Taliban, or the failures in the war.

But they have provided more detailed content to what we already knew.

Extraordinary panic

The leaks have generated such extraordinary panic around the world because they come at exactly the wrong time.

The policies of all the major players, such as the US, Nato, and Pakistan, as well as Afghanistan, are changing while they try to seek a way to end the war and pull out their troops.

The US Congress and others must realise their paramount task should be to end the war by stabilising Afghanistan, talking to the Taliban and promoting a regional settlement.

At this late stage they should not be passing blame and hyper-ventilation about cutting economic aid to Islamabad or Kabul.

Image caption Wikileaks released 90,000 leaked classified documents on the war

Blame, if it must be passed, should be shared fairly.

For eight years the administration of President George W Bush ignored President Hamid Karzai's weaknesses; disregarded Pakistan's Inter-Service's Intelligence's (ISI) support for the Taliban; allowed Afghan-Pakistani tensions to escalate; and critically, never provided enough US troops or money to finish the job when the Taliban insurgency was a mere trickle.

In contrast, in the past 18 months the Obama administration has seriously tried to turn around the conflict.

In Afghanistan, the US is seeking to reduce corrupt contracting practices and provide more scrutiny of aid funds, while at the same time allowing 50% of it to go through the Afghan government.

A new US military policy to reintegrate Taliban fighters and conduct a better counter insurgency with fewer civilian casualties is in place.

But everyone realises that ultimately the war cannot be won on the battlefield and a dialogue with the Taliban is needed.

Over four dozen trips to Pakistan by two leading US officials, Chairman of the Joint Chiefs of Staff Admiral Mike Mullen and Special Representative Richard Holbrooke, as well as frequent visits by John Kerry, Hillary Clinton and others have created a new dynamic with the most anti-American ally the US has ever had.

Short-term fixes

Six months ago, Pakistani leaders were accusing the Americans of "undermining" them with a $7.5bn five-year aid bill for Pakistani civil society.

Now Islamabad's ministries and non-governmental organisations are tripping over each other putting up development proposals to the US embassy.

Image caption The US is monitoring aid money in Afghanistan

The US has initiated a long-awaited strategic dialogue with Pakistan which covers not just security, but 12 development subjects such as energy, water and education.

It is now dawning on many Pakistanis that Mr Obama is genuine about seeking a long-term relationship with Pakistan, rather than the short-term fixes of the past with the army receiving billions of US dollars and civil society ignored.

US pressure and military aid has resulted in the army seriously going after the Pakistani Taliban for the first time since their eruption six years ago.

That campaign is only 15 months old and the Pakistani army has taken over 1,000 casualties.

For the first time in nine years, President Karzai and Pakistani leaders, including the ISI chief General Shuja Pasha, have been frequent visitors to each other's capitals.

The two sides are trying to forge a common strategy to talk to the Taliban and bring the war to an end.

Under US pressure and influence, both countries have signed a historic transit trade agreement, which allows Afghan exports to go overland to India. It's the first such agreement since 1965.

The ISI has been a major destabilising influence in the past. Few have documented this as I have in two books (Taliban and Descent Into Chaos). But Wikileaks have added little that is new.

The ISI helped launch the Taliban in 1994, then supported its resurrection in 2003 after it had been defeated and driven out of Afghanistan. In 2005 it backed the Taliban in its drive to try to capture the city of Kandahar.

All change

Army chief General Ashfaq Kiyani, too, must bear some of the responsibility because he served as ISI chief from 2004-07. Gen Kiyani just received an extension as army chief for the next three years.

But the situation has changed.

Gen Kiyani wants an end to the Afghan war and the destabilisation of Pakistan.

He knows that as the end-game approaches he has to take on board the interests of other neighbouring states and the non-Pashtun minorities in Afghanistan who have historically loathed the ISI.

The recent Kabul conference has set 2014 as a ballpark timeframe for Western forces to hand over to Afghan security forces.

But well before that accommodation must be found with the Taliban, with Pakistan's help.

John Kerry, Chairman of the Senate Foreign Relations Committee, told a Senate hearing on 27 July that ''Pakistan is more crucial to the outcome than what happens in Afghanistan itself in many cases", and that ''Pakistan remains central… and perhaps holds the key.''

Mr Kerry is dead right and this is not the time for Congress or European parliaments to make an already woeful situation impossible.

Ahmed Rashid's book, Taliban, has just been updated and reissued on the 10th anniversary of its publication. His latest book is Descent into Chaos - The US and the Disaster in Pakistan, Afghanistan and Central Asia.