united FRONT: David Cameron with, from left, Pakistan Prime Minister Raja Pervaiz Ashraf and Afghanistan president Hamid Karzai in Kabul.
The Prime Minister said British support for the country would remain long after the planned exit date, which will see all international combat forces leave.
Afghan security forces are "capable and large" but Britain's support will continue for many years, he said.
"The Taliban should be in no doubt that we will handing over to a very large, very capable Afghan security force," Mr Cameron said at a joint press conference with Afghan President Hamid Karzai.
He added: "You cannot wait this out until foreign forces leave in 2014 because we will be firm friends and supporters of Afghanistan long after 2014."
Pakistan Prime Minister Raja Pervaiz Ashraf is understood to have delayed his visit to Afghanistan so he could coincide with his British counterpart's visit.
Mr Cameron said: "The terrorists that are trying to wreck Afghanistan are the same terrorists that are trying to wreck Pakistan. This is one fight that we all need to be engaged in to save Afghanistan from Talibanisation and we need to do the same to help Pakistan."
Mr Karzai praised Mr Cameron for being a long-term friend of the nation.
The two leaders signed a memorandum of understanding on the planned "Sandhurst in the sand" training academy, which will see British military leaders train their Afghan counterparts.
Meanwhile, Pakistan and Afghanistan agreed to resume regular talks on Afghanistan's peace process, with the new Pakistani Prime Minister promising to help arrange meetings between Afghan and Taliban representatives.
Following day-long talks in Kabul, also involving Mr Cameron, Mr Ashraf and Mr Karzai said they had agreed to resume meetings of the two-track Peace Commission.
The commission, which drew together political and military leaders from both neighbours, was suspended last year following the assassination of former Afghan president and peace envoy Burhanuddin Rabbani. Afghan officials accused Pakistani intelligence of being involved in the killing.
Pakistan is seen as crucial to stability in Afghanistan as most foreign combat troops look to leave the country in 2014, given its close political and economic ties and because militants' sanctuaries straddle the border.
However, Afghan officials have openly accused Islamabad of doing little to help them reach senior Taliban leaders that Kabul says are based in Pakistan. Pakistan denies this and also the existence of senior insurgents within its territory.
Contextual targeting label: