Voting errors by the Liberal Democrats last night diluted the impact of the government's victory to extend home tagging as a way of easing prison overcrowding.

There were two votes, one which would have enabled electronically tagged early release to apply for the first time to prisoners who had been sentenced to more than four years. This vote went against the government by four votes, but only because four LibDems accidentally voted the wrong way and two dashed into the chamber too late.

There was then a second vote allowing prisoners to be released into home curfew six months before their planned release date, an extension of six weeks on the present period, and this was won by 65 votes to 60.

Scots Justice Secretary Kenny MacAskill had been beaten on the issue of home detention curfew (HDC) at the Justice Committee last week on the casting vote of convener Bill Aitken after Labour and the Tories united in a spoiling operation to demand a "sunset clause" on the provision, meaning it would have had to come back to MSPs next year.

The first of last night's vote was a technical procedure known as a "negative instrument" in the name of the Parliamentary Bureau preserving the status quo by calling for no action.

Since the effect of passing this would be to prevent the extension of HDC to longer-term prisoners, the SNP and LibDems were meant to vote against it. But because it appeared on the business bulletin in the name of the government's parliamentary business manager Bruce Crawford, some LibDems thought they were meant to vote in favour.

Ross Finnie, John Farquhar Munro, Jamie Stone and Alison McInnes all voted the wrong way in error, while party leader Nicol Stephen and parliamentary group convener Iain Smith arrived too late to cast their vote.

"We have a reputation of winning votes in the chamber but this was one we were meant to lose," said an SNP spokeswoman. "We're deeply disappointed with the LibDems. It seems they cannot get out of the habit of voting with Labour."

A LibDem spokesman said: "It was an administrative mix-up and not in any way a deliberate position by the MSPs concerned. We will have to wait and see what advice the government receive on bringing this issue back to the chamber in the interests of clarity.

"But the main thing to take out of today was the Labour Party and Tories set out to unite in voting against a proposal which would have brought an improvement to our criminal justice system."

Mr MacAskill had described the six-week extension to eligibility for home curfew as a "straightforward, commonsense measure" at a time when Scotland's prison population reached new record levels on a weekly basis.

"High risk offenders will still be excluded," he said. "Everyone will still have to serve a quarter of their sentence. This order does not change the way in which HDC operates or how prisoners are assessed to determine their suitability.

"All I propose is to use the flexibility provided for in the previous administration's legislation to enable low risk, short-term prisoners to be out on HDC for slightly longer, for the last six months of their sentence rather than the last four and a half months.

"Given those facts, I was surprised at last week's rejection of this order in its present form by the justice committee."

But Bill Aitken, for the Tories, said: "The SNP say that this will only affect an additional 50 prisoners. That is nonsense.

"This legislation enables them if they so wish to release hundreds of prisoners and is part of the open doors strategy which Kenny MacAskill and his colleagues believe in. They have said that they want to cut prison numbers and this is simply a ploy to achieve that aim.

"The SNP is out of touch with public opinion in Scotland."

Bill Butler, the Labour MSP who came up with the "sunset clause" manoeuvre last week, said such a move would be "a welcome sign of mature reflection" on the part of the government.

"This matter is too serious for soundbites and petty party politicking," he told MSPs. "When it comes to the safety of our communities, all members - including those recently raised to ministerial rank - should employ reason and seek to build consensus and should not sit smiling when serious points are being made."