Military commanders are pressing for international forces to be allowed to provide extensive logistical advice to Afghanistan until 2020, after concluding that local security forces will be unprepared for full operations when the Nato mission ends next year.

In a sign of tensions between Downing Street and the military, the prime minister used a visit to Afghanistan to rule out any British involvement in such a role after Nato concludes its combat operations at the end of 2014.

Speaking at a press conference in Kabul with the Afghan president, Hamid Karzai, David Cameron hailed the work of Afghan security forces, though he left open the possibility that other Nato countries could provide logistical support after 2014. He said: "There will be no British combat troops after the end of 2014. British troops are coming home. That is happening right now.

"After 2015, we have said that our contribution will be an officer-training academy, which President Karzai asked us to establish. We have not made any other commitments, and nor have we been asked to. Of course, other Nato countries may choose to do more and assist the Afghan forces – not in a combat role. But from everything I have heard, the Afghan forces are doing a good job; they are highly capable, motivated and they are capable of delivering security."

The prime minister spoke out after military sources raised the alarm about security in Afghanistan after 2014. Sources said they have concluded that Afghan forces will need highly technical military advice on providing close air support, the distribution of food and fuel, and on medevac facilities. There were concerns recently in Sangin when an Afghan brigade had to call off a mission after running out of fuel.

British military commanders have been able to make their assessments after Nato handed control of security for the whole of the country to Afghan forces this month. The commanders have concluded that a great deal has been achieved, but that Afghan forces will not have built their capacity to full operational levels by the time Nato combat troops leave at the end of 2014.

The signs of disagreement between No 10 and the military emerged as the prime minister visited Afghanistan amid heavy security after the recent Taliban attack on the green zone in Kabul. An unusually strong blackout was imposed on the visit after the Taliban intercepted communications on the prime minister's travel plans to the country in 2010.

Cameron arrived after Lieutenant-General Nick Carter, the deputy commander of Nato operations in Afghanistan, told the Observer that opportunities to build a dialogue with the Taliban were missed in the past decade. The US recently announced that it would hold talks with the Taliban, who have been allowed to open a political office in the Qatari capital, Doha.

Cameron indicated that he had some sympathy for Carter's view. But he made a point of acknowledging the unease of the families of fallen soldiers about the government's decision to endorse talks with the Taliban. "What I would say to everybody ... is that we should be very proud of the work that British armed service personnel have done here in Afghanistan," he said.

"We came here in 2001 with a very clear purpose – that was to stop this country being used as a base for terrorist attacks against Britain. We have been successful in that task."

The prime minister came close to endorsing Carter's criticisms of the failure in the past to reach out to the Taliban. He told Sky News in Lashkar Gah: "I think you can argue about whether the settlement we put in place after 2001 could have been better arranged. Since I became prime minister in 2010, I have been pushing for a political process and that process is now under way."

The US agreed to talk to the Taliban after dropping a series of pre-conditions which had included an unequivocal renunciation of al-Qaida and an agreement to abide by the Afghan constitution. The Taliban simply said it agrees that Afghanistan should not be used as a base to attack other countries.

British diplomatic sources voiced strong support for the change of tack by the US. They even suggested that the Afghan constitution could be amended to take account of some of the Taliban's concerns.

One source said the constitution follows a winner-takes-all approach which concentrates strong powers in the hands of the president. This is not seen to be compatible with a process of reconciliation. But the other key Taliban demand – to give the constitution a more Islamic flavour – is regarded as unacceptable because diplomatic sources believe the constitution is sufficiently Islamic.

Any changes to the constitution would take place after the presidential election in April 2014. Karzai has to stand down as president after serving two terms.

The sources said that Taliban prisoners would have to be released as part of negotiations. They would be free to play a role in the Afghan armed forces.

The prime minister announced during his visit that a wall at the main British army base at Camp Bastion, which commemorates soldiers who lost their lives in the conflict, is to be dismantled and rebuilt in Britain with funds from the Libor bank fines. The Bastion Memorial Wall at the National Arboretum in Staffordshire will be built with £300,000 from the £35m armed forces covenant (Libor) fund.