Britain's troops can come home "with their heads held high" when they leave Afghanistan next year, because they will have accomplished their mission, David Cameron has said during a Christmas visit to the military in Helmand province.
The Prime Minister was insistent that no UK combat troops will be based in the nation by the end of 2014, even if there is a rise in insurgency.
Senior military figures are braced for increased activity as more troops pull out and expect elections being staged next year to be a particular focus for insurgent groups.
During a tour of Camp Bastion, likely to be his last for a seasonal meet-and-greet with troops on the ground, he said Britain had more than played its part in Afghanistan.
Asked by reporters if the troops come home with "mission accomplished", the Prime Minister said: "Yes, I think they do. I think they can come home with their heads held high."
He added: "To me, the absolute driving part of the mission is a basic level of security so it doesn't become a haven for terror. That is the mission, that was the mission and I think we will have accomplished that mission and so our troops can be very proud of what they have done."
Around 5,200 British troops are now based in Afghanistan, down from 9,000 at the start of the year. There have been 446 British deaths.
"The timetable for the withdrawal of British troops is a plan that we will stick to," he told Sky News.
"I said, back in 2010, that after the end of 2014 there would not be British troops in a combat role and we will stick to that.
"We are not going to abandon this country. We are going to go on funding the Afghan National Army and police into the future.
"We will have a development programme into the future and, of course, we are providing what the president of Afghanistan asked me for, which is an officer training academy in Kabul which will help provide the backbone of the Afghan National Army for the future.
"So, we have more than played our part in helping to rebuild this country and making it safe.
"Our commitment goes on into the future, but our troops have done enough and it's time for them to come home."
The number of UK bases has reduced from 13 to five since the Prime Minister's last visit in June.
Mr Cameron took a helicopter to a forward operating base, Sterga 2, in the Nahr-e Saraj part of Helmand, where he had lunch with a small group of soldiers.
Lance Corporal Bill Hay, 24, said he was impressed and pleased by the visit.
"I'm most surprised by the fact he's actually coming out here. Most of the time, people will only get as far as Bastion. So I'm quite chuffed and interested that he's pushed further."
Mr Cameron told reporters not to read anything into the fact that he had not visited President Hamid Karzai in Kabul during the trip.
Over the weekend the Afghan premier claimed the United States threatened to abandon it to civil war in a row about the continuing presence of military bases in the nation.
Mr Cameron insisted the bilateral security agreement would go ahead.
"Well, I'm confident that this agreement will be signed," he said.
"It's in Afghanistan's interest to have a basic agreement so that American troops and others can help with basic security all the way up to the transition and provide some support in the future.
"That's clearly in Afghanistan's interest, that's in America and Nato's interest, and so I'm confident that after some discussions an agreement will be signed."
Asked whether Mr Cameron was seeking to echo former US President George W Bush's 2003 announcement of the end of major combat operations in Iraq in front of a banner reading "mission accomplished", the Prime Minister's official spokesman pointed out that the words were initially introduced by a journalist to whose question he was responding.
"I think it's understandable. He was asked a question, he answered in the way he did," said the spokesman.
The spokesman added: "The Prime Minister was explaining what the armed forces have achieved. Is the situation in Afghanistan a perfect one? As the Prime Minister himself has said, No.
"But has the situation improved significantly in terms of the threat that the terrorists posed? - because that's the reason we intervened. Yes, it has and that is as a result of the achievements of our armed forces."
Shadow defence secretary Vernon Coaker said: "David Cameron should have chosen his words more carefully.
"We can be proud of the contribution that Britain's Armed Forces have made and are making in Afghanistan. But the mission is ongoing and our troops will be on the frontline until well into next year.
"In the run-up to Christmas, our brave servicemen and women and their families will be acutely aware that the job is not done in Afghanistan. They will need the continuing support of the British public over the coming weeks and months.
"There is no room for complacency when our Armed Forces are engaged in an ongoing, dangerous and complicated military operation."