By Darren Waters
Technology editor, BBC News website
The ad-serving system profiles the sites people visit online
The Home Office has been accused of colluding with online ad firm Phorm on "informal guidance" to the public on whether the company's service is legal.
E-mails between the ministry and Phorm show the department asking if the firm would be "comforted" by its position.
The messages show Phorm making changes to the guidance sought by the ministry.
Lib Dem Home Affairs spokeswoman Baroness Sue Miller, who has questioned the Home Office about Phorm, said the e-mails were "jaw dropping".
A Home Office spokesperson said the suggestion of "collusion" was totally unfounded.
"We have repeatedly said since these documents were released a year ago that the Government has not endorsed Phorm or its technology.
"We are committed to protecting the privacy of UK consumers and will ensure any new technology of this sort is applied in an appropriate and transparent manner, in full accordance with the law and with proper regulation from the appropriate authority."
The e-mail exchanges were released under a Freedom of Information (FOI) Act request made by a member of the public and sent to the BBC.
The exchanges between the Home Office and Phorm date back to August 2007, in which the ministry asks the company for more information about the technology following a request made by Phorm for a view on its technology.
The Home Office has said previously that exchanges were about helping the department understand "public safety considerations and legal obligations" about behavioural advertising in general.
Phorm serves up adverts related to a user's web browsing history that it monitors by taking a copy of the places they go and search terms they look for. Adverts related to that history are put on any websites that have signed up to use Phorm.
So far BT has signed up to use the system, and carried out a series of trials, some of which were conducted without the consent of its users, sparking an outcry among privacy advocates.
The European Commission has also separately started legal action against the UK over the use of Phorm.
E-mails from legal representatives of Phorm released under the FOI Act show the company repeatedly asking the Home Office if it "has no objection to the marketing and operation of the Phorm product in the UK".
The Home Office has previously denied that it has provided "any advice to Phorm directly relating to possible criminal liability for the operation of their advertising platform in the UK".
However, e-mail exchanges over a series of months between the department and the firm show the Home Office asking the firm what it thinks of the advice it is drawing up in relation to behavioural targeted advertising, and making specific reference to Phorm's technology.
In an e-mail dated August 2007, an unnamed Home Office official wrote to Phorm's legal representative and said: "My personal view accords with yours, that even if it is "interception", which I am doubtful of, it is lawfully authorised under section 3 by virtue of the user's consent obtained in signing up to the ISPs terms and conditions."
In an e-mail dated 22 January 2008, a Home Office official wrote again to Phorm and said: "I should be grateful if you would review the attached document, and let me know what you think."
In January 2008 the Home Office thanks Phorm for comments and changes to its draft paper, which show the company making deletions and changes to the document.
The Home Office official wrote to Phorm: "If we agree this, and this becomes our position do you think your clients and their prospective partners will be comforted."
Baroness Sue Miller, Liberal Democrat spokeswoman on Home Affairs, told BBC News: "My jaw dropped when I saw the Freedom of Information exchanges.
"The fact the Home Office asks the very company they are worried is actually falling outside the laws whether the draft interpretation of the law is correct is completely bizarre."
She added: "I couldn't be more surprised [that] the very department drawing up policy to protect people's privacy is being that cynical.
"Anything the Home Office now says about Phorm is completely tainted."
In a letter to the Guardian responding to an article written by Baroness Miller, Phorm's chief executive Kent Ertugrul denied there was any "collusion" between the firm and the Home Office.
He wrote: "This is untrue and misrepresents the way in which the British legal system works."
He said the advice given by the Home Office was "an informed opinion on ISP-based targeted advertising, but in the United Kingdom it is for the courts to decide what is or is not legal, not the Home Office".
Baroness Miller said she was concerned that the Home Office was "very interested in the technology" for its own purposes.
However, Mr Ertugrul said it was "misleading to invent a link between Phorm's innovative technology and the Government's plans for counterterrorism".
Phorm has consistently defended its technology, saying it offers greater privacy protection than rival systems, and that it could help generate fresh sources of advertising revenue for websites.
The company has also stressed it believes consumers will benefit because they would receive more relevant adverts.
The company has launched a website, which it says is aimed at stopping the "orchestrated smears" against Phorm.
Jim Killock, executive director of privacy campaigners, the Open Rights Group, said: "The Home Office's job is to uphold the law: not to reinterpret it for commercial interests.
"It's extraordinary, when you think of the blatant disregard Phorm showed towards UK laws in its secret trials, that this sort of lax attitude should be shown."