Head of UK's MI5 warns of terrorist threat