The former head of MI5 has said the threat of Islamist terrorism is a “generational problem” and warned the UK may face it for another “20 to 30 years”.

Jonathan Evans told the BBC Radio 4’s Today programme that “there’s no doubt that we still are facing a severe terrorist threat”, but that the UK must “persevere” with efforts to defeat it.

The warning came immediately after new figures showed that hate crimes had sharply risen after recent terror attacks in London and Manchester, but had fallen after a terror attack on a Finsbury Park Mosque.

Evans was the head of the UK's counter-intelligence agency for six years during which he oversaw security for the 2012 London Olympic and Paralympic Games. He left the position in 2013 at a time when the threat from al-Qaeda appeared to be diminishing.

Evans was at MI5 for 33 years. He dealt with Irish-related terrorism in the 1980s and 1990s, before joining international counter-terrorism investigations in 1999.

He became director of international counter-terrorism 10 days before the 11 September attacks and took the role of director-general in 2007, during which he oversaw security for the 2012 London Olympics. Evans left in 2013, at a time when the threat from al-Qaeda appeared to be diminishing.

“Since the 1990s we have been experiencing difficulties in the UK and elsewhere in Europe from Islamist terrorists of one sort or another," he said.

"We're at least 20 years into this. My guess is that we will still be dealing with the long tail in over 20 years' time. I think this is genuinely a generational problem. I think we are going to be facing 20 to 30 years of terrorist threat and therefore we need, absolutely critically, to persevere."

Evans highlighted that 19 attempted attacks have been disrupted since 2013, but in the time since the March 2017 Westminster attack there had been six attempted attacks halted.

Hate crimes jump after UK terror attacks

His comments came after new figures showed a sharp rise in mainly race- or faith-based hate crimes after three terror attacks in the UK.

Published by the National Police Chiefs Council, the figures showed a 50 percent increase in the number of hate crimes reported in the week of a bomb attack in Manchester compared with the previous year.

The Manchester attack was the UK's deadliest since the 2005 London bombings. Twenty-three people were killed when 22-year-old Salman Abedi detonated a bomb outside the Manchester Arena following a music concert on 22 May 2017.

The weeks of the Westminster and London Bridge attacks also saw a 12 percent and 34 percent increase in reported hate crimes, respectively.

The figures showed a decrease in hate crimes after an attack on a London mosque when a man drove a rented van into a crowd of worshippers outside the Finsbury Park Mosque.

The driver of the van was quoted as saying “I want to kill all Muslims”, and describing his actions as “for London Bridge”.

Hate crimes dropped seven percent in the week of the attack and 28 percent in the third week after the attack.

A schoolgirl leaves flowers outside the Finsbury Park Mosque following a van attack on worshippers (AFP)

"We know that terrorist attacks and other national and global events have the potential to trigger short-term spikes in hate crime,” said assistant chief constable Mark Hamilton.

“Reporting from police forces show that levels of hate crime peaked in the wake of the attacks but quickly subsided within a few days.”

“Across the country we have seen people and communities reject these hateful divisions by defiantly celebrating our shared values and diversity and showing we will not be intimidated by an intolerant minority.”