Charities have expressed their disappointment after the government's controversial lobbying bill squeezed through the House of Lords on Tuesday, despite fears it could limit freedom of speech in the run-up to an election.

Many voluntary groups and trade unions have been campaigning against the legislation, branding it the "gagging bill", because it would put new restrictions on how much they can spend while campaigning on political issues before an election.

Ministers were forced to back down in several areas after peers rejected key parts of the legislation. Graham Allen, the Labour MP in charge of scrutinising the bill, accused ministers of presenting a "dog's breakfast". But on Tuesday the government won votes on two amendments and tied on another, meaning the bulk of the original proposal will pass into law.

In a last-ditch attempt to frustrate the bill, Lord Harries, who chairs the Commission on Civil Society and Democratic Engagement representing more than 100 groups, warned it would be a "bureaucratic nightmare" and accused ministers of imposing a "huge regulatory burden on campaigning groups".

Liz Hutchins, senior campaigner at Friends of the Earth, said it was a "bad day for anyone wanting to protect the environment, save a hospital or oppose tuition fees".

Sir Stephen Bubb, chief executive of the Association of Chief Executives of Voluntary Organisations (ACEVO), added that the matter "does not finish today".

"ACEVO will be monitoring the impact of the bill," he said. "We'll be asking our members how the legislation affects their work. We'll work closely with our members to give advice on its implications. And we'll continue to agitate for political parties to revise this bad bill in light of our evidence after the 2015 election.

"We must be clear: civil society must never lose its voice. We must stand up for our beliefs and refuse self-censorship. ACEVO will work tirelessly to ensure that this Bill does not gag charities and campaigners."

Lord Wallace of Tankerness, deputy Lords leader, denied the requirement would be "burdensome," and insisted most staff costs would be excluded from campaigning limits. The government argues very few third party organisations will be caught up by the new laws.