British troops will only be withdrawn from Afghanistan when Afghan security forces are ready to take over their role, David Cameron said on Saturday.

Speaking with Afghan president Hamid Karzai at Chequers, he said "I don't want to see some sort of cliff edge in 2014 when all of the remaining troops come out at once but clearly, between now and 2014, the rate at which we can reduce our troops will depend on the transition to Afghan control in the different parts of Afghanistan and that should be the same for all of the members of Nato."

Cameron's comments follow the decision of France to withdraw its troops a year ahead of schedule after four French soldiers were killed by an Afghan soldier they were training. The move has been criticised in Afghanistan.

The prime minister said Britain "has paid a heavy price" for fighting insurgency but insisted progress was being made. He paid tribute to the latest British casualty in Afghanistan, a soldier from the 1st Battalion The Yorkshire Regiment, and said his thoughts were with the man's family.

A total of 397 British forces or Ministry of Defence personnel have died while serving in Afghanistan since October 2001.

Cameron and Karzai signed a pledge setting out the next stage in relations between Britain and Afghanistan.

The "enduring strategic partnership" renews a 2005 agreement and sets out a shared vision of a secure, stable and prosperous Afghanistan able to maintain its own security and prevent the country from being used as a safe haven for international terrorists.

Cameron said the level of violence was down across the country, particularly in Helmand, and the building of the national army and police force were "on target".

"I think part of achieving that is not just what we are doing on the ground with all the Nato partners but also the need for what the president and I have often spoken about, for a political process that ensures all Afghans, if they give up violence, if they give up terror, can play a part in a strong democratic state for the future."

Karzai said Britain had been Afghanistan's "steadfast friend" over the last decade. The Afghan people "appreciate" the sacrifices that have been made, he added.

"May I convey to the people of Britain the gratitude of the Afghan people for all that Britain has offered Afghanistan, for having been ready to sacrifice, and having been ready to share, hard earned taxpayers' money with Afghanistan for the benefit of Afghan life."