The coalition government suffered an embarrassing parliamentary defeat in its attempt to undermine the British constitution yesterday, even though a leading defender of human rights was forced to vote against his own amendment.

There were extraordinary scenes in the House of Lords as peers debated the public bodies bill, which will allow ministers to modify, merge or abolish a huge range of quangos. Individual peers have been attempting to protect individual public bodies. But what has united and enraged the government's opponents is not so much the policy of culling quangos, more the method that ministers have chosen to put their plans into effect.

As the Lords constitution committee said on November 4, the public bodies bill "strikes at the very heart of our constitutional system, being a type of 'framework' or 'enabling' legislation that drains the lifeblood of legislative amendment and debate".

This is because the bill would enable junior ministers to amend acts of parliament by little more than a stroke of the pen. The committee recommended that ministers should not be allowed to exercise these so-called Henry VIII powers without much greater safeguards.

As if that was not bad enough, the bill also lists a large number of public bodies that the government does not yet want to modify, merge or abolish – but might in the future. These include the Judicial Appointments Commission, which selects judges. Lord Woolf, the former lord chief justice, told the Lords on November 9 that the bill was "a matter of grave concern to the judiciary".

As peers pointed out in a debate lasting more than eight hours, the bill puts bodies such as the Independent Police Complaints Commission under the knife of an individual minister, jeopardising their hard-won independence.

Lord Taylor of Holbeach, the government whip responsible for the Cabinet Office bill, responded with the promise of "a parliamentary procedure that will ensure proper public consultation and enhanced parliamentary scrutiny". He also said he would consider a reprieve for bodies dealing with the administration of justice.

But that was not good enough for Lord Lester, a QC with long experience of defending human rights in parliament. He moved an amendment on Tuesday paving the way for much greater restrictions on the powers that the bill would give ministers. As envisaged, his amendment would prevent a minister from amending or abolishing a public body in a way that was incompatible with judicial independence, incompatible with human rights or disproportionate.

Lester's speech struck me as lacklustre and technical. The reason became clear later. A former special adviser to the Labour home secretary Roy Jenkins, Lester helped to create the Social Democratic Party in 1981 and now finds himself a Liberal Democrat member of a Conservative-led coalition. He was clearly under considerable pressure not to press his concerns to a vote. Withdrawing his proposals would have allowed the government to come up with its own half-hearted amendments later in the bill's committee stage.

But other peers were having none of it. They heard a powerful speech from Lord Pannick QC, who described the proposed legislation as a "bad bill" that conferred excessive power on the government.

Before Pannick became a QC – and, in Lester's words "a rather greater authority than I could ever be in administrative law" – he often appeared in court as Lester's junior. Again, their names were coupled on the order paper: Pannick had added his name to Lester's amendments.

But, unlike Lester, Pannick is a crossbencher who was appointed to the Lords purely because of the skills he could bring. He is not a "working peer" appointed to support a particular party in the voting lobbies. And despite holding down a busy practice at the bar in London and abroad, Pannick has rapidly established himself as an active and effective member of the Lords – unlike some other "people's peers".

He therefore had no hesitation in calling on Lester to force his amendment to a division. Lester declined, asking leave of the house to withdraw his amendment. Normally, this is a formality. But not this time: the government's opponents forced a vote and passed the Lester/Pannick amendment by 235 to 201, a majority of 34. Lester felt obliged to support the coalition and vote against his own amendment.

Since the amendment is technically incomplete, the vote was largely symbolic. But, yet again, it sent a clear message to the government: don't mess with parliamentary democracy.

Joshua Rozenberg is a freelance legal writer, commentator and broadcaster