Jonathan Evans, who stepped down as director-general of the agency in 2013 and now sits in the House of Lords as a crossbench peer, described the issue as a "generational problem".
"I think on the terrorism side we are at least 20 years into this. My guess is that we will still be dealing with the long tail in another 20 years' time," he told the BBC.
"I think this is genuinely a generational problem. When I left MI5 in 2013 if I had been asked I would have said that I thought that we probably were over the worst of the Al Qaeda threat. That may have been true but of course not the development and emergence of IS (Islamic State) with the same ideology and many of the same people," Evans said.
Lord Evans also said that the devices connected to the Internet needed to be made more secure in the face of emerging cyber threats and warned of a threat from Russian hacking.
More From This Section
"It would be extremely surprising if the Russians were interested in interfering in America and in France and in various other European countries but were not interested in interfering with the UK because traditionally I think we have been seen as quite hawkish," he said.
"As our vehicles, as our air transport, as our critical infrastructure is resting increasingly on the Internet we need to be really confident that we have secured that because our economic and our daily lives are going to be dependent on the security that we can put in to protect our infrastructure from cyber-attack," Evans warned.
Meanwhile, the head of the UK's national counter- terrorism policing described the current Islamist terror threat a "cultish movement" compared to Al Qaeda which was "a very tight network of wicked individuals".
"This widening cohort of people that we're concerned about and our ability to keep our radar on them is no longer just a job for police and security services," Rowley said.