The MI5 chief also backed the prime minister on a separate point, saying there was a hack and leak in the 2019 election campaign.