While I agree with the principle, and have severe objections to the security services being allowed to engage in that kind of surveillance because of the significant threats it poses - I would rather take the risk of extra terror as I see it as far smaller -, this does still not preclude elected officials from being terrorists or having close contact with terrorists.
Nothing says that terrorists, or their supporters, never represents the will of at least a sufficient part of the people to gain representation.
In fact, we have many prominent examples where terrorists or people with close associations with terrorist groups have been elected to public office. Some you might sympathise with, others not so much: IRA's ties to Sinn Fein, which has seats in the UK parliament, for example. Or the ANC, whose armed wing used to carry out bombings targeting civilians. Or Hamas. Or most prime ministers of Israel (most of whom were parts of terror organizations like Irgun or Haganah in their youth).