I can't find a breakdown of the 40,000 figure quoted by pp. But this is what MI5's site says. Italics are mine.
MI5 is responsible for investigating all forms of terrorist threat to the UK. Primarily, this stems from Islamist terrorism, extreme right-wing terrorism, Northern Ireland-related terrorism and, to a lesser degree in terms of volume, left-wing, anarchist or single-issue terrorism.
Islamist terrorism is the most significant terrorist threat to the UK by volume.
Islamist terrorists are generally driven by an extreme interpretation of Islam or perceived grievances against ‘the West’, particularly those propagated by terrorist groups such as Daesh (also referred to as ISIL, ISIS or the Islamic State) or al-Qaeda.
Much of the volume of the threat is from individuals who have self-radicalised, seeking to carry out attacks using unsophisticated or low-sophistication methodologies. Generally, individuals will decide themselves to conduct an attack, rather than the attack being directed or controlled by a terrorist group. This can make it harder to identify terrorist activity.
There also remains an enduring threat from overseas terrorist groups which seek to inspire, support or enable attacks and which retain an intent to conduct sophisticated attacks.
The extreme right wing terrorism landscape has evolved away from structured groups towards a more diffuse threat where individuals form loose networks, often online. The ideologies and grievance narratives are varied, wide-ranging and often overlapping. They can encompass elements of cultural nationalism, white nationalism, and white supremacism and are often fuelled by conspiracy theories.
Extreme right-wing influencers operating globally online seek to fuel grievances and amplify conspiracy theories.
Much of the volume of the threat is from self-radicalised terrorists seeking to conduct low-sophistication attacks. Generally, individuals will decide themselves to conduct an attack, rather than the attack being directed by a terrorist group. This can make it harder to identify terrorist activity.