The Liberal Democrats have voted overwhelmingly in favour of a digital bill of rights that would prevent the government from embarking on the "bulk collection of data".

Just two Lib Dems voted against the motion at the party's spring conference in York that would also establish a commission of experts to review all the evidence highlighted in the National Security Agency files leaked by the whistleblower Edward Snowden.

Martin Horwood, MP for Cheltenham who represents GCHQ, was the only MP to speak against the motion's call for a ban on the collection of bulk data.

Nick Clegg announced last week that he has commissioned a review of the surveillance techniques of Britain's intelligence agencies and the legal framework underpinning their work. The independent review is to be led by the Royal United Services Institute after the Lib Dems failed to persuade David Cameron to establish a government review.

The motion says that surveillance without suspicion is "alien to our traditional British values." It would oblige the government to stop the bulk collection of data and only access metadata or the communications of an individual if there were grounds for suspicion.

A commission of experts would review state surveillance and all the evidence on the Snowden files and scrutinise all the relevant legislation, including the controversial Regulation of Investigatory Powers Act 2000 (RIPA). It would also examine "the implications for privacy and internet freedoms" in the documents revealed by Snowden, in particular Project Tempora in which GCHQ secretly gained access to the network of cables carrying the world's phone calls and internet traffic.

Julian Huppert, MP for Cambridge who tabled the motion with the party president Tim Farron, told the conference: "I think we owe a great debt to the Guardian both for bringing this data out and for doing it in a controlled way. We did not have a WikiLeaks style exposition of everything the agencies do.

"The problems we have – I don't believe there are lines of people at the agencies breaking the law. I think we, as parliament, as politicians, wrote rubbish law. It is our fault. RIPA doesn't work, it is out-dated. Oversight has failed."

Huppert added that commitments made by a former GCHQ director had not been met. "Sir David Omand said that recourse to secret intelligence must be a last resort. It is not a last resort if you collect the email as soon as it is sent.

"Sir David also said another brilliant comment: 'Democratic legitimacy demands the way new methods of intelligence gathering are to be introduced should be on a firm legal basis and rest on parliamentary and public understanding of what is involved'.

"He is absolutely right and I am proud to stand with a former head of GCHQ. We failed to do that. We got it wrong and we now have to fix that."

But Horwood, whose parents worked at GCHQ and at Bletchley Park during the second world war, called on the conference to delete a line in the motion calling for the ending of bulk collection of data. His call received a reasonable level of support but was defeated in a show of hands.

The MP opened his speech with a joke as he thanked Lib Dems for praising the work of the intelligence agencies. He said: "My friends in what we lovingly call locally the doughnut will welcome that and appreciate it. They tell me the next three speeches are pretty good too. Joke, in case you're listening."

Horwood said that GCHQ had been subject to inaccurate criticism by people it is seeking to protect. He said claims that GCHQ sought to bypass the law was "deeply resented" because senior managers were "completely obsessive about following the letter of the law". He said: "People at GCHQ would never seek to draw the line between civil liberty and national security themselves. That is our job in political and civil society. But, Tim [Farron], they do believe they are working to protect liberty, not undermine it."

Horwood, who said that some GCHQ employees were attending the Lib Dem spring conference as party members, said it was wrong to ban the collection of all bulk data. "That is a little bit rich for a political party that, just like all other political parties, collects the entire electoral register, phone numbers, age profiles, demographic and lifestyle data and then adds information on people's personal political beliefs and suspected personal political beliefs on an industrial scale."