David Cameron and Afghan President Hamid Karzai have played down the impact of Wikileaks cables which revealed strong criticism of UK military operations in the country.
Mr Cameron said the leaks - one of which quoted Mr Karzai saying Britain was "not up to the task" - should not "come between a strong relationship".
At a meeting in Kabul Mr Karzai said he appreciated the UK's "hard work" there.
Mr Cameron has said troops could start coming home as early as next year.
At a news conference in the Kabul presidential palace, Mr Karzai described himself as a "good friend" of Mr Cameron.
He said there were "some truth and some not-so-truths" in last week's Wikileaks disclosures.
The cables contained harsh criticism of the UK military effort in Afghanistan from 2007 to 2009.
As well as US officials and Mr Karzai saying they believed UK forces were not up to the task of securing Helmand province on their own, the Afghan president reportedly said he was relieved when US Marines were sent to the province.
Asked on Tuesday if he would apologise for his quoted words, he said: "Britain has been a steadfast supporter of Afghanistan and of the Afghan people. Britain has contributed in the sacrifice of its soldiers, of blood and of resources in Afghanistan, for which the Afghan people are extremely grateful."
Mr Cameron said the criticism was "related to a previous period when we all know now there were not enough troops in Helmand".
He added: "I don't want the Wikileaks to come between a strong relationship."
Mr Karzai denied having criticised British military tactics, saying: "I can certainly tell you that there was no discussion ever between Afghanistan and any other country about Britain's tactical operations. It was on the lack of ability to cover large parts of the province where the Taliban were gaining ground."
He joked that future leaks might reveal what the UK and Afghanistan said about the US.
"We were very nice about them," Mr Cameron said.
"Most of the time," replied Mr Karzai.
Talking to reporters earlier at the UK's main Camp Bastion base in Helmand province, Mr Cameron conceded there were sometimes "frustrations" and "frank exchanges" about the situation in Afghanistan.
"Of course Wikileaks has led to lots of embarrassing questions and all the rest of it, but I think, in the end, it does not change any of the fundamentals between Britain and America, it doesn't change any of the fundamentals between Britain, America and Afghanistan, but obviously it has provided a lot of copy," he said.
The prime minister is also due to hold talks with America's top military leader in Afghanistan, Gen David Petraeus, in Kabul before returning to the UK.
'Friendly fire' death
Earlier Mr Cameron said progress against the Taliban and in training Afghan military and police made him optimistic about the prospects for the first withdrawals of British troops, in 2011.
Mr Cameron had already committed to withdrawing combat troops from Afghanistan by 2015.
BBC deputy political editor James Landale, who is travelling with Mr Cameron, said it was almost a tradition now for prime ministers to visit Afghanistan before Christmas.
Like his predecessors, he went there to assess the situation on the ground and to thank British forces for what they are doing in the country.
He did this with some in person at an isolated patrol base and with others by a round-robin Army fax.
While there Mr Cameron also paid tribute to a British soldier killed in Helmand province on Sunday, in a suspected "friendly fire" incident, and promised that a "proper investigation" would take place.
Reports have indicated that an attack on an insurgent position by a US aircraft may have been the cause.
"It's absolutely tragic when incidents like this happen and my heart goes out to the family concerned. There will have to be a proper investigation to find out what happened and how this went wrong," said Mr Cameron.
He announced that the UK would invest £135m in doubling the capability of unmanned drones, used to seek out and destroy roadside bombs. The money is expected to pay for about five new remotely-piloted aircraft which will be in service by 2013.
Mr Cameron was also shown Warthog armoured vehicles - the first tranche arrived in Afghanistan in September, with more expected later.
Our correspondent said Mr Cameron was so confident about progress made that he said it was now possible some British combat troops could start returning to the UK next year.
Not everyone in the Army was keen on the idea but the prime minister has a firm commitment to get all combat troops out of Afghanistan by 2015 and wanted to make a start, our correspondent added.
Mr Cameron said: "We have to deliver on the ground what's necessary, but what I've seen today gives me cause for cautious optimism.
"We are ahead of schedule on training up the Afghan National Army, I've just been to see Afghan police officers being trained up - 500 every eight weeks coming out of an academy run by the British. There are signs for optimism."
The head of the UK Armed Forces, Chief of the Defence Staff General Sir David Richards - who accompanied Mr Cameron on a tour of bases - said there had been an "astronomical" quickening of results on the ground and said success in the mission was "eminently do-able".
On the Wikileaks revelations he said the cables had at no point criticised the "ability of the British soldier".
"It was all about our inability to produce the force ratios - those days are past us and our linkages at every level with the American armed forces are incredibly strong."
The UK has more than 10,000 troops deployed in Afghanistan.