The Taleban "will need to be involved" at some stage with a peace process in Afghanistan, UK Defence Secretary Des Browne has said.
Des Browne predicted a long-term presence in Afghanistan and Iraq
At a fringe meeting at the Labour Party conference, he said a solution would have to be "Islamic based".
Mr Browne said Taleban involvement would happen "because they are not going away" any more than Hamas was from the Palestinian territories.
He said the UK needed to see through "commitments" in Afghanistan and Iraq.
There are more than 7,500 British troops fighting the Taleban in Afghanistan, and about 5,500 soldiers in Iraq.
Mr Browne told delegates at the meeting hosted by the IPPR think-tank: "These are challenges we should not take on if we are not prepared to see them through and some of them are commitments for decades, some of them may be commitments for generations."
However, he stressed the commitment would not necessarily be military.
The defence secretary also said Labour needed a "progressive agenda" on defence.
"There are significant questions we need to ask ourselves as a party about our relationship with defence policy and consequently about those who we ask to deliver it," he said.