There are nearly 9,000 British troops in Afghanistan
Harriet Harman has defended the UK's strategy in Afghanistan against growing criticism that the objectives of the mission have become confused.
As well as preventing the spread of terrorism, Labour's deputy leader told MPs that UK troops were helping rebuild society such as widening education.
But opposition parties said the war aims needed to be clearer so people could judge the progress being made.
Seven British soldiers have been killed in Afghanistan in the past week.
UK and US troops are in the middle of a major offensive against the Taliban in the south of the country as they aim to secure more territory ahead of elections next month.
Ms Harman, standing in for Gordon Brown at prime minister's questions, said no-one should doubt the importance of the UK's military commitment in Afghanistan.
She was responding to a question from Conservative MP John Maples who said many of his constituents were "beginning to doubt the wisdom" of the war and questioned the UK's precise military objectives.
Ms Harman said the UK's aims were two-fold, focusing on security and reconstruction.
"It is important to make sure in the mountainous regions surrounding Afghanistan and Pakistan we do not have a crucible for the development of terrorism that threatens not only the people in that country but the region and indeed the whole world."
She added: "I think this mission is important too for the education of people in that country. There are now six million children in school in Afghanistan while in early 2001 there were only one million.
"Our troops have led the way, working with other international forces, in making that possible.
"They are paving the way the way for economic development, for a more secure democracy as well as security in the region and the world."
The Tories said they supported the goal of stabilising Afghanistan and ensuring it could not be used as a base for exporting terrorism.
But they said ministers must be more realistic about what could be achieved and over what period of time.
"If we can get it broadly stable and if we can get it able to look after its internal and external security and if we can get reasonable governance, at that point we can say we have done a good job," said defence spokesman Liam Fox.
But Mr Fox said "too many mistakes" had been made, enabling, in some cases, the Taliban to regain territory that had previously been captured by Nato forces.
"One of the things that is missing is a very clear strategy that says what the end point is going to be," he added.
"We also don't properly have benchmarks which enable us to determine if we have been successful along the way."
SNP leader Alex Salmond said the objectives set out by Ms Harman were not "particularly convincing".
"As for the explanation that there are more children being educated, that is a very wonderful and laudable thing but certainly not in itself a justification for the sort of international military action we are seeing at the moment."
A public debate on the UK's role in Afghanistan was needed, he added, including an assessment of the current situation, a clarification of objectives and an indication of how long forces would remain there.
The BBC's Political Editor Nick Robinson said the lack of a vigorous political debate about Afghanistan reflected the cross-party support for the initial military action in 2001 in contrast to the widespread opposition to the Iraq war.
But he said the growing death toll may change that, prompting calls for a clearer focus on what is achievable.