Britain must be ready to deal with Islamic State fighters plotting attacks from nations such as Afghanistan, the Defence Secretary warned last night.
Gavin Williamson said the fanatics are changing tactics as they face defeat in Iraq and Syria.
He warned of a potential insurgency in other nations that could give terrorists a safe haven to attack Britain.
These nations include Afghanistan and countries such as Libya, defence sources said.
His alarming comments came as a top RAF commander said a 'hardcore' element of IS extremists need to be killed before they flee and 'export terrorism' back to Britain.
At a crucial Nato summit this week members will discuss the security situation in Afghanistan. Theresa May is expected to announce more training troops will be sent there.
Speaking ahead of a huge flypast over London to mark the centenary of the RAF tomorrow, Mr Williamson – using the Arabic acronym for Islamic State – said: 'Daesh is facing territorial defeat in Syria and Iraq but the battle against their poisonous ideology and barbarism is not over. We must be prepared as the terrorists change their approach, disperse into other countries and prepare for a potential insurgency.
'Daesh remains the most significant terrorist threat to the UK due to its ability to inspire, direct and launch attacks. That is why we continue working through the Global Coalition to hunt down Daesh terrorists wherever they lurk.'
Afghan forces have struggled to fight the Taliban, who have regained swathes of territory after British and US troops pulled out in October 2014.
Afghans are also having to fight thousands of fanatics from IS who have fled Syria and Iraq.
It is feared at least two British fighters may be among those who have already fled to Afghanistan and foreign fighters could be learning new skills in terror training camps in the country.
Britain's security agencies believe the threat from the group could increase over the next two years as it disperses.
New figures show IS now holds just 2 per cent of the territory it once controlled in Syria and Iraq after an air campaign lasting nearly four years.
Some 50,000 of the terrorists have been killed by coalition forces, leaving a few thousand remaining. The RAF has carried out 1,700 strikes, including hitting British passport holders plotting massacres in the UK.
Jihadis have been forced to hide in caves and in the desert where they continue to plot attacks and remain a threat, RAF chiefs said. Air Commodore Roddy Dennis, in charge of air operations, said those remaining in the country were the 'hardcore element'.
He said: 'Where we see ourselves now is in that final stage is removing those hardened fighters. I'm very confident we will see the ultimate demise in the south eastern part of Syria.'
Speaking at RAF Akrotiri in Cyprus, Group Captain Andrew Dickens, the commanding officer of 903 Expeditionary Air Wing, said: 'It is the beginning of the end. [IS] now hold less than 2 per cent of the land they held at the beginning of the campaign.
'We are clearing them out of those last few pockets where they were dominating the ground. But we say it is the beginning of the end because they still exist.'
This article has been adapted from its original source.
© Associated Newspapers Ltd.