David Cameron has warned Britain must be "ready for further casualties" in Afghanistan over the summer.
The PM, updating MPs after his visit, said he wanted to bring troops home "the moment it is safe to do so".
He also said he had been advised that the threat from al-Qaeda from Pakistan and Afghanistan had reduced - but would return if troops left.
Defence Secretary Liam Fox said Britain would not "lose our nerve" in Afghanistan, despite budget pressures.
The government is holding a strategic spending review.
Dr Fox has not ruled out troop cuts but he has said the UK's nuclear deterrent will not be affected by the review.
Mr Cameron told MPs Britain was in Afghanistan for UK national security as it was "not yet strong enough to look after its own security".
But he said: "Our forces will not remain in Afghanistan a day longer than is necessary and I want to bring them home the moment it is safe to do so."
However he said although he had been advised "that the threat from al-Qaeda from Afghanistan and from Pakistan has reduced" he had also been told that it would increase again if UK and international forces left.
He said this year - including the 18-month military surge - was "the vital year" - and the international forces must "redouble our efforts to drive progress".
Some "real progress" had been made in central Helmand this year but progress was not "irreversible".
He said he had announced £67m to double the number of counter-IED teams but he was not pretending "that every equipment shortage has been resolved".
He also warned: "I do not pretend it will be easy... we must be ready for further casualties over the summer months as the so-called fighting season resumes and as Isaf [International Security Assistance Force] extends its activity."
Acting Labour leader Harriet Harman welcomed Mr Cameron's early visit to Afghanistan and said Labour would give him "our full support" when taking "difficult decisions in the best interests of our mission in Afghanistan and our troops".
She also asked for assurances on the upcoming strategic defence review "that the frontline will not be weakened" and asked why Sir Jock Stirrup and Sir Bill Jeffrey were leaving their posts - as announced on Sunday - and paid tribute to their "service to this nation".
Air Chief Marshal Sir Jock, the head of the armed forces, is to step down in the autumn after the review, before his term ends while top MoD civil servant Sir Bill Jeffrey will also go.
Sir Jock's early departure was announced at the weekend by Dr Fox, who denied he had been sacked.
Mr Cameron paid tribute to both as "extremely strong and dedicated public servants". He said Sir Jock had done a "superb job" but had "for some time had in mind standing down in the autumn" after the strategic defence review.
Mr Cameron made his statement hours after Dr Fox gave a speech to the Royal United Services Institute in which he said "hard-headed decisions" were needed, with the Ministry of Defence needing to become "more efficient".
He said there was "no doubt" over the "need for reform and change", adding: "There are no illusions about the scale of the challenges we face."
He insisted the UK's security would need a "clean break" from Cold War-legacy thinking.
Dr Fox said: "Resources are tight for the country as a whole and defence is no exception. This review must be anchored in the art of the possible.
"We cannot insure against every imaginable risk and so we need to decide which risks we are willing to meet and which risks we are willing to take."
Results of consultations on the Strategic Defence Review, overseen by the National Security Council, would be published in a White Paper by the end of the year, he said.
Dr Fox added: "We face some difficult, delicate and politically charged decisions. There are competing priorities, risks to manage and budgets to balance.
"We must act ruthlessly and without sentiment. It is inevitable that there will be the perception of winners and losers as we go through this process.
"But defence as a whole will, and must, come out in a stronger position."