UK government was involved in discussions with the Guardian newspaper about material it had obtained from American whistle-blower Edward Snowden.