The West can only contain, not defeat, militant groups such as al-Qaeda, the head of the UK's armed forces has said.
General Sir David Richards, a former Nato commander in Afghanistan, said Islamist militancy would pose a threat to the UK for at least 30 years.
But he told the BBC's Andrew Marr Show a clear-cut victory over militants was not achievable.
The BBC's Frank Gardner said the comments reflect a "new realism" in UK and US counter-terrorism circles.
Our security correspondent said such an admission five years ago might have been considered outrageous and defeatist.
Gen Richards, 58, took over as chief of the defence staff last month, after a spell as head of the British army.
Before he was due to lay a wreath at the Cenotaph as part of the UK's Remembrance Sunday commemorations, Gen Richards told the BBC's Andrew Marr Show it was important to get the balance of remembrance right.
"It's something we've got to be very careful about... there's a lot of dwelling on death as opposed to what those people who have died achieved in their sadly too often too brief lives, but those people have done immense things that are good and I think we need to focus a bit more on that," he said.
Britain has lost 343 soldiers in Afghanistan since 2001.
But Gen Richards told the BBC it was not possible to defeat the Taliban or al-Qaeda militarily.
"You can't. We've all said this. David Petraeus has said it, I've said it.
"The trick is the balance of things that you're doing and I say that the military are just about, you know, there.
"The biggest problem's been ensuring that the governance and all the development side can keep up with it within a time frame and these things take generations sometimes within a time frame that is acceptable to domestic, public and political opinion," he said.
He said extremist Islamism could not be eradicated as an idea.
"I don't think you can probably defeat an idea, it's something we need to battle back against as necessary, but in its milder forms why shouldn't they be allowed to have that sort of philosophy underpinning their lives.
"It's how it manifests itself that is the key and can we contain that manifestation - and quite clearly al-Qaeda is an unacceptable manifestation of it," he said.
Shadow defence secretary Jim Murphy told the BBC Gen Richards was "right" that there was no purely military solution and said there would be "no white flag surrender moment".
"This is a complicated issue. It will be for the long haul. It's got to do with history.
"But I think he's right to talk about the different ways that this has got to be taken on - militarily yes but diplomatically and in a peaceful sense of nation building in Afghanistan is also important," he said.
Former British Chief of the General Staff, General Sir Richard Dannatt, agreed warfare had entered a new era and needed the support of development programmes.
"In conventional wars, you talk about winning and losing.
"What we're trying to do here is succeed sufficiently to put Afghanistan as a sufficiently stable state that can look after itself and doesn't become ungoverned space into which al-Qaeda or other terrorist groups could reoccupy," he said.
Gen Richards comments came as the Foreign Office apologised to a group of MPs after a fact-finding trip to Afghanistan and Pakistan had to be called off because of a security lapse.
Next week's visit by members of the Commons defence select committee was cancelled after an unencrypted e-mail was sent out by an embassy official in Kabul, prompting fears that the MPs' safety may have been compromised.
The Foreign Office said it would be trying to rearrange a visit for the MPs.
A Foreign Office spokesman said: "We have offered our apologies for this regrettable lapse in our procedures and have assured the committee that we will do all we can to arrange a successful visit in the future."