Arthur Duncan raised a judicial review maintaining the failure was incompatible with the European Convention on Human Rights (ECHR).
A judge said the periods "give rise to complaints - which appear on the present material to have considerable force - the Scottish Ministers failed to provide him with programmes and courses which they recognised were a necessary part of his rehabilitation and which were necessary to enable him to make progress towards having an effective review before the parole board".
Lord Glennie said Duncan had shown "a prima facie case" that there had been a breach of Article 5 of the ECHR which protects the right to liberty and security.
Ministers contended that, while Duncan's progress through the rehabilitation system was not as fast as he wanted, the rate of progress was "a matter of judgement for the prison authorities".
The judge said he had reached only a provisional view and that a further hearing should take place with the chance to lead evidence.
The level of damages for the murderer will also be considered if Lord Glennie holds to his preliminary view in the action.
The judge said: "A finding that the detention is arbitrary and unlawful for such period does not necessarily lead to the conclusion that the prisoner must be released.
"But it will, in the ordinary course, entitle him to claim damages for distress caused by the failure of the prison process and for such other damages as he may prove to have suffered."
Ex-soldier Duncan was 18 when he murdered and raped 22-year-old Linda Bull in Hampshire, in 1970.
He was sentenced to life and later transferred into the Scottish prison system. In 2002 a Scottish judge ruled he should serve a minimum term of 10 years before he could seek release.
Parole authorities have refused to sanction his release on public protection grounds.
In 2003 he was transferred to the open prison at Noranside, in Angus, as part of a plan to release him in Aberdeen. The plans altered when he became engaged to a woman who had been visiting him in Edinburgh.
The Parole Board's Life Prisoner Tribunal (LPT) decided against his release but recommended he stay in open prison ahead of a further review in 2004.
However, Duncan was found with hardcore pornography videos and was sent to Peterhead prison. While there he was found to have cut pictures from papers of brides and written their names and addresses on the photos.
The LPT said he had admitted to a social worker he fantasised about going to one of the women's homes and tying her up. He also admitted having a DVD of females being tied up and attacked.
Lord Glennie said Ministers had noted that he used the pictures to have "sexual offence related fantasies". But Duncan's counsel, Dorothy Bain, QC, told the Court of Session in Edinburgh there had been "a continuing failure to allow proper opportunity for real rehabilitation".
She said at one stage ministers accepted Duncan should take part in a course which would address sexual fantasies. But she added: "It was identified he could not undertake the programme due to its withdrawal." No alternative arrangements were put in place.
Duncan claimed that as he was deprived of rehabilitation he did not have the chance to address his behaviour. He said the result was he could not satisfy authorities that he was suitable for release.
His counsel said it was only later when a different course was brought in that "things have managed to move on".
Lord Glennie said "there was no proper opportunity of access to any rehabilitation programmes from about April 2007 until about July 2013, a period of some six years".