Liberal Democrat activists have rejected plans to introduce so-called "secret courts", after two prominent members resigned over the issue.
Members at the party's spring conference voted against plans to hold some civil proceedings in private for fear of damaging national security.
Human rights barrister Dinah Rose and ex-parliamentary candidate Jo Shaw have quit the party over the issue.
MPs have backed the proposals, despite some Lib Dems and Tories rebelling.
Ministers argue millions of pounds are wasted settling civil claims which the government is prevented from challenging successfully because that would involve revealing secret intelligence in open court.
Ms Rose QC represented former Guantánamo Bay detainee, Binyam Mohamed in his case against the British intelligence services.
In 2011, 16 terror suspects, including Mr Mohamed, received a multimillion-pound pay-out after they claimed they had been mistreated by US and British security and intelligence officials.
The Justice and Security Bill would create a mechanism allowing court evidence to be heard in secret where there is a need to keep information from the public on grounds of national security.
The government has introduced safeguards to the legislation, currently being scrutinised by Parliament, ensuring judges and not ministers decide when so-called closed material proceedings are used.
But this was no enough to satisfy Lib Dem members at the conference.
Speaking at the podium, Ms Shaw resigned from the party, describing "secret courts" as "shoddy logic".
She told her leader: "It's not me Nick; it's you."
Ms Shaw said the leadership had "abandoned liberal values for the privileges of power".
"The Lib Dem leadership have decided that civil liberties is not a red line issue," she said. "I am today resigning from the Liberal Democrats. I am a liberal and I am a democrat and we are against this sort of thing."
But justice minister Lord McNally warned blocking the legislation, which would allow for courts to sit in secret in some civil cases, would mean there was less scrutiny of the security services.
They would continue to pay compensation rather than disclose sensitive information in public, causing serious "reputational damage".
The vote in favour of the emergency motion came shortly ahead of Mr Clegg's closing speech, which argued the Lib Dems were no longer a "party of protest" but one of government.
But the courts issue has alienated many members, worried the Justice and Security Bill will undermine the openness of justice.
Last week, Lord Neuberger, the UK's most senior judge, warned any lawyer or member of the judiciary "worth his salt" would be "troubled" by the changes.
The bill was given its third reading in the Commons, but is expected to face strong opposition in the Lords.