The UK faces a continuing serious risk of a lethal terrorist attack taking place, the head of MI5 has warned.
Jonathan Evans raised concerns over the number of soon-to-be-freed inmates who are "committed extremists and likely to return to terrorist activities".
He also said Somalia and Yemen were important concerns for MI5, as a source of serious plots against the UK.
And, he said, the security service had not expected dissident republicanism to grow as it had in Northern Ireland.
Mr Evans, who made the rare public remarks to the Worshipful Company of Security Professionals in London, said dealing with international terrorism remained the main focus of MI5's efforts.
"Counter-terrorist capabilities have improved in recent years but there remains a serious risk of a lethal attack taking place. I see no reason to believe that the position will significantly improve in the immediate future," he said.
He said hundreds of officers were involved in an "intense struggle", largely out of sight of the public.
Every month, hundreds of new leads come into MI5 headquarters at Thames House from various sources, with only sufficient resources to investigate those that appeared to be high priority, Mr Evans said.
"At any one time we have a handful of investigations that we believe involve the real possibility of a terrorist attack being planned against the UK," he said.
One concern is that a number of individuals, convicted of offences in the years after the 9/11 attacks, are now coming out of prison having served their terms.
"We know that some of these prisoners are still committed extremists who are likely to return to their terrorist activities," Mr Evans said, adding that they would be added to the cases that needed to be monitored.
He said another change in recent years was the source of the most serious plots.
In previous years, officials have said that 75% of priority plots had links to Pakistan. That figure has now dropped to 50%.
This was partly because of pressure on al-Qaeda leadership operating in Pakistan's tribal areas, but it was also a sign of a diversifying threat, he said.
Mr Evans said in Somalia there were a "significant number of UK residents training in Al Shabaab camps" to fight in the country.
"I am concerned that it is only a matter of time before we see terrorism on our streets inspired by those who are today fighting alongside Al Shabaab," he warned.
He said Yemen was the other main country of concern.
He said the involvement of the radical preacher Anwar Al Awlaqi in a succession of plots - and the influence of his message in the UK - had raised concerns that his adherents, possibly lone individuals, would respond by mounting attacks.
There had been a surge in Yemen-related casework this year, he said.
It is widely believed that the raising of the UK terror threat level to "severe" at the start of 2010 was largely related to intelligence surrounding Yemen.
Mr Evans admitted that when MI5 assumed the lead responsibility for intelligence in Northern Ireland in October 2007, its "working assumption" was that the residual threat from terrorism was low, and likely to go down.
Instead the opposite has happened. Mr Evans described a "persistent rise in terrorist activity and ambition", with signs of increasing co-ordination and co-operation between disparate groups in recent months.
This year there had been more than 30 attacks or attempted attacks by dissident republicans on security targets, compared with just over 20 for the whole of last year, he said.
Mr Evans also warned that while the campaign by dissident republicans was currently focused on Northern Ireland, MI5 "cannot exclude the possibility" that it might spread to the mainland.
Mr Evans also warned against a "zero tolerance" attitude to the terrorist risk, which he said was spreading.
"In recent years we appear increasingly to have imported from the American media the assumption that terrorism is 100% preventable and any incident that is not prevented is seen as a culpable government failure.
"This is a nonsensical way to consider terrorist risk and only plays into the hands of the terrorists themselves. Risk can be managed and reduced but it cannot realistically be abolished and if we delude ourselves that it can we are setting ourselves up for a nasty disappointment," he said.