British Foreign Secretary William Hague says spying is essential to protecting people's freedoms, but it must be done within the law.