General Sir Peter Wall said he was confident that Afghan forces had the capability to keep the country secure after foreign combat troops leave at the end of this year.
However, if the situation changes and the Taliban insurgency gains ground, British troops could be required to go back in, the chief of the general staff said.
"It is vital that Afghan forces continue to deal with any threat of Al-Qaeda's return to the country," Wall told the Daily Telegraph.
"But for the moment, it is a matter for the Afghans and their leadership.
More From This Section
"On balance, I am optimistic that this will be made to work."
Britain currently has around 4,100 troops in Afghanistan, a Ministry of Defence said. Some troops will remain in Afghanistan in a training role after the pullout.
Wall said Afghan forces had the upper hand over the Taliban, having provided security for two elections, which showed the insurgency had lost the initiative.
"But that is not to say they are yet completely defeated," he added.
"There is more to do in some of the more conservative areas that have not had the benefit of the social changes that have taken place elsewhere in the country."
He said the conflict had left Britain with a "warrior generation" prepared for future conflicts.
A total of 453 British troops have lost their lives in the Afghanistan operation since it began in October 2001. Of these, 404 were killed as a result of hostile action.