SNP ministers were forced to consider housing criminals on “prison ships” and introducing Norway-style waiting lists for cells to cope with dangerous levels of overcrowding in jails.

Scottish cabinet papers released by National Records of Scotland reveal the problem was discussed repeatedly throughout 2008 by the fledgling SNP government.

Then  justice secretary Kenny MacAskill said he and officials had also considered using military bases, boot camps, and scrapping jail altogether for certain offences.

Officials also considered at introducing "a system similar to that in Norway, which operated a queueing system for non-violent offenders to serve their sentence".

Although most of the ideas were rejected, Mr MacAskill told colleagues the early release of inmates was being actively considered, despite the “presentational difficulties”.

He also warned the cabinet that inmates might be able to mount successful challenges to their conditions under the European Convention on Human Rights (ECHR). 

Ministers agreed to conduct a “legal liability risk assessment” to identify and quantify the risks, both civil and criminal, to the Government as a result of the overcrowding. 

At the time, the Scottish prison estate had an operating capacity of 6,625.

In mid-February 2008, Mr MacAskill told cabinet the prison population had hit 7,609 and he hoped to get an expansion of home detention curfews (electronic tagging) through Holyrood.

A week later, he told cabinet that prisoner numbers “continued to rise”, and the capacity of the prison estate to absorb additional offenders was an issue of “great concern”. 

In March, Mr MacAskill reported his attempt to extend home detention curfew (HDC) to long-term prisoners and use it for longer periods had been rebuffed at Holyrood.

He warned cabinet “there was potential for a real crisis in Scotland's prisons” and it was worth risking a legal challenge to release some “low-risk prisoners slightly earlier”.

Mr MacAskill also reported he had visited the new Addiewell prison the previous day, which was due to open in January 2009 and house 700 inmates, but that was still not enough.

He said overcrowding in Scotland's prisons “was becoming a matter of some urgency” and ministers might be forced to release inmates if an emergency suddenly reduced capacity. 

The minutes state: “He said that the situation was now so serious, with a new record of 8,045 prisoners having been reached that day, that in the event of a fire or other emergency, permission might require to be sought from the Government for an emergency release.”

In May, ministers were told the overcrowding was so bad it was possible inmates “could mount a successful challenge under the ECHR”. 

Mr MacAskill proposed passing secondary legislation to create a short-term release programme for prisoners in case overcrowding became unmanageable.

He warned there would have to be a work element involved, otherwise prisoners’ living costs would have to be paid by the Government because they were ineligible for benefits.

The cabinet feared that it could be seen “to be paying prisoners for early release”. 

Mr MacAskill conceded there would be “significant presentational issues”.

He said that for every 100 prisoners in the early release programme, £6,000 would have to be paid in discharge grants and £8,000 weekly in living costs.

He went on to say “very few of the measures I am proposing will be easy to sell – either politically or to the public”.

Mr MacAskill said “tabloid media” would slam the Government as “soft” on crime and “anti-prison”, while it would become easier for members of the former Labour-Liberal Democrat Scottish Executive to distance themselves from the problem.

In July, Mr MacAskill warned that, as well as the ECHR issue, the government could “face litigation over some of the short-term measures” it was using to cope with overcrowding.

In September, he said the numbers of prisoners had hit 8,092, with another 354 on HDC, and there was a concern of growing unofficial action by prison officers refusing to accept any more inmates, as had happened at Glenochil.

He said consideration was being given to changing Castle Huntly from an open prison to a closed prison, and transferring low risk offenders into the open estate for up to six weeks at the end of their sentence.

Other options included “temporary early release for employment, training or education”, and “compassionate release for offenders with certain categories of health problems”.

A week later, Mr MacAkill reported the prison numbers were up again, to 8,137 plus 356 on HDC, which “represented an all time high”.

The minutes state: “Until HMP Addiewell came on-stream in December 2008, there was a risk that the prison estate would be unable to cope if a major incident occurred.

“He said that there was no scope for use of police cells as an emergency measure; and that pro-active consideration was being given to early release schemes, as a contingency.”

On 30 September, Mr MacAskill told cabinet the prison population had fallen slightly to 8,056 inmates plus 353 on HDC but the Scottish Prison Service (SPS) had compiled a list of those it might need to release in an emergency involving “an unexpected loss of capacity”.

The SPS also warned Castle Huntly could not be converted to a closed prison for a year.

“Finally, he said that SPS had considered a range of options, including the use of state hospitals and military bases to house prisoners, but they had advised against pursuing these options further.”

The cabinet agreed to a full paper on the issue the following week listing all options, including “those which had previously been ruled out and why”.

That paper, discussed on 7 October, said the SNP had been aware of the “relentless increase” in prisoners since entering office and the problem was “likely to worsen and needed to be addressed”.

Mr MacAskill said his paper included an Annex of “measures that are still being actively considered”, although “on the face of it, some of these are not attractive options”.

These included “emergency release powers”, releasing low risk prisoners early, and reconfiguring the open prison estate.

There was also an Annex of “measures officials or I have considered but have discounted as being impracticable and unworkable and the reasons for this”.

This included “prison ships, disused hospitals etc”, boot camps for young offenders, military service, a cap on prisoner numbers, and ending jail for certain offences.

Most were dismissed because of expense, legal problems and likely public hostility to them.

He said SPS had also investigated the potential for using the UK Government’s immigration centre at Dungavel in Ayrshire, but had been rebuffed by the UK Border Agency.

Mr MacAskill wrote: “Very few of the measures I am proposing will be easy for us to sell -either politically or to the public. The tabloid media are likely to accuse of being ‘soft’ on law and order and ‘anti-prison’.”

The minutes state: “Other options for reducing prison numbers included placing a cap on prisoner numbers and introducing a system similar to that in Norway, which operated a queueing system for non-violent offenders to serve their sentence, although this could have presentational difficulties.”

The cabinet agreed to “carry out a legal liability risk assessment that identified and quantified the legal risks, both civil and criminal, for the Scottish ministers as a result of the pressures in the Prison Estate”.

The cabinet also noted the measures which had been considered and agreed to ask the Treasury for “additional investment” under the Barnett funding formula for Holyrood.

Mr MacAskill continued to update cabinet on prison numbers as they dropped off through the rest of the year.