It was the timebomb ticking away in the prison system which everyone seemed keen to ignore. Despite successive international and domestic warnings that slopping out and prison conditions across Scotland were inhumane, almost nothing was done to improve the state of the county's jails.

Former justice minister Jim Wallace even diverted some £13m away from prison development into other areas of the justice department in December 1999 - money which, later investigations proved, could have at least stemmed the tide of litigation.

The financial implications of such complacency exploded under the previous Scottish Executive, when a single prisoner took them on and won.

The court ruled that Robert Napier, a remand prisoner, had been forced to suffer inhumane and degrading conditions, partly as a result of the fact he had to slop out in Barlinnie.

In 2004 he was awarded £2450 for the effect slopping out and other prison conditions had on his health. Hundreds of prisoners came forward as a result.

As the numbers seeking compensation swelled and the courts became inundated with cases, the executive decided to cut its losses, believing it was protected, in part at least, by the one-year time bar which restricts claims under the European Convention on Human Rights (ECHR).

Forced to face the reality of the situation, a settlement was reached with hundreds of prisoners last year. It cost less than £500,000 in claims. The bomb, it thought, had gone off.

Yesterday, however, it emerged that the repercussions, the delayed action of the device, would be far worse and far more expensive than the initial explosion.

Mr Napier won only a small level of compensation because he spent just six weeks in prison. Others, who have spent years slopping out and may still be doing so, are expected to call for much higher remuneration as a result of yesterday's ruling.

Prison managers have had to set aside tens of millions for possible claims and admitted yesterday there was a £76m contingency pot for just such a scenario.

At the heart of yesterday's ruling are four violent criminals who believe their human rights were abused during their time spent in segregation. The inmates, through their lawyer Tony Kelly, challenged segregation for being unfair; the refusal to grant them a hearing and the fact there was no opportunity for them to make legal representation.

It has been a long and protracted process. When their case originally went to court, Lady Smith, on most of the points, ruled in favour of the inmates, but that decision was reversed by the appeal court in Edinburgh in November 2006. Lawyers were then granted leave to appeal to the Law Lords.

Essentially, the Law Lords ruled yesterday that decisions on human rights cases should be taken under the Scotland Act rather than the ECHR.

The Scotland Act, which accommodated the convention in 1999, has no specific time bar.

This test case will not only have ramifications for thousands of prisoners, but for any other human rights case brought before the courts in Scotland.

Those wishing to sue ministers for breaching their basic human rights on a range of issues should also find the time bar lifted. Not only does it mean petitioners have longer than a year to take the case to court; the length of time over which the injustice took place, and thus the corresponding amount of compensation, could be much higher.

Criminals traditionally take up a smaller than average proportion of the country's sympathy. Rightly so, many would argue. But they have the same human rights as anyone. Their punishment is to lose their liberty, not to face degrading conditions once locked up.

Slopping out was eradicated in England and Wales by 1995, and ministers said they would remove the need for it in Scotland by 1999. However, until recently, it was still common practice in parts of Barlinnie, Perth, Polmont and Edinburgh prisons.

In Peterhead, some 300 prisoners are still forced to use chemical toilets - a form of slopping out.

In December 1999, the time by which the practice should already have been removed, Mr Wallace was called before the parliamentary justice and home affairs committee to explain the decision to divert the funds and close other prisons, such as Dungavel. He said: "It is no longer considered possible to reach the predicted end date (of slopping out). It is one of the results (of the cuts)."

He revealed the money would be diverted into other areas of the justice budget. At the time it must have seemed a simple decision, but the costs of such short-sightedness will be felt for years to come.

Prison experts said this money should and would have been invested in the planned improvements of prisons such as Barlinnie where the refurbishment programme was significantly delayed.

Documents showed that if the changes planned for Barlinnie in the 1990s had gone ahead, Mr Napier and hundreds of others would not have been forced to slop out. The bill to taxpayers could have been avoided.

In his ruling on the Napier case, Lord Bonomy wrote: "It is thus plain that the cell conditions in C Hall could have been addressed before 2001.

"It is equally plain the respondents took a deliberate decision not to address them when they had both the resources and the capacity to do so. They decided the cell conditions for remand prisoners in C Hall would not be improved prior to 2001, and then assigned the petitioner to C Hall when he was committed to custody in their hands."

The prison service is currently spending almost £1.5m on improving the state of Scotland's prisons to make them compliant with human rights legislation, but lawyers believe thousands of inmates will now make claims.

Each prisoner will still have to prove their health suffered as a result of the conditions in which they were kept, but the new administration still faces a very expensive clean-up operation.

As one official put it yesterday: "No-one likes paying out money to criminals." Unfortunately they should have realised this more than a decade ago, before the ticking bomb went off.



Prisoners at the centre of the case

Andrew Somerville
Somerville was jailed for life - a minimum of 20 years - in September, 1993, after he shot dead a stranger after abducting him and his fiancee at gunpoint.

He admitted abducting Craig Anderson, of Whitburn, and his fiancee, Jacqueline Fisher, 23.

Somerville, 44, killed Mr Anderson by repeatedly shooting him in the head and body with a shotgun. Miss Fisher escaped by throwing herself out of the car.

Three days earlier, Somerville had abducted Jane Wilson, the mother of his three children. He also shot a police officer, Peter Cavanagh.



Sammy Ralston
Ralston was jailed for six years for holding up the TSB in Easterhouse, Glasgow. His sentence was doubled after being a ringleader in the worst riots at Barlinnie. Dubbed "The Bear," Ralston, 43, staged a rooftop protest at Peterhead and has been stabbed inside prison. He has claimed assault by prison officers and, later, a legal right to worship.



David Henderson
The 37-year-old is serving seven years for assault to severe injury, permanent disfigurement and danger of life.



Ricardo Blanco
Blanco is serving life for murder.

The 43-year-old killed Paul Thorne, 26, a Bristol drugs courier, in 1989.

The victim was lured to Fenwick Moor, Ayrshire, and shot.

Blanco, from Spain, has married while in jail.