The appellant was sentenced to an extended sentence of ten years imprisonment, comprising a custodial term of seven years and an extension period of three years. He was released on licence after serving two thirds of the custodial term, but was recalled to custody after committing a further offence. He then remained in prison until the sentence had been served in full. In these proceedings, he complains that he was not provided with appropriate rehabilitation courses following his recall to prison, contrary to article 5 of the European Convention on Human Rights (the Convention), as given effect in domestic law by the Human Rights Act 1998. The principal issue in this appeal is whether the duty under article 5 to provide prisoners with a real opportunity for rehabilitation applies to prisoners serving extended sentences. The lower courts found that there was no violation of article 5. The Supreme Court unanimously dismisses the appeal, upholding the decision that there was no violation of article 5(1)(a). Lord Reed gives the lead judgment, with which the rest of the Court agrees. Previous decisions on Article 5(1)(a) In James v United Kingdom (2013) 56 EHRR 12 (James), the European Court of Human Rights (ECtHR) applied the general principle that article 5(1) requires the conditions of detention to be consistent with the purpose of the detention. Based on that principle the court concluded that after the punishment part (the tariff period) of an indeterminate sentence for public protection (IPP) has been served and the prisoner remains in detention for reasons of public protection, a real opportunity for rehabilitation should be provided [8 18]. The Supreme Court (UKSC) in R (Kaiyam) v Secretary of State for Justice [2014] UKSC 66 (Kaiyam) accepted there was an obligation to provide life and IPP prisoners with a real opportunity for rehabilitation, but held this was not imposed by article 5(1). Rather, the duty was an ancillary duty in the overall scheme of article 5 and existed throughout the prisoners detention. James was not part of a clear and constant line of decisions. The UKSC was concerned that the approach in James might give prisoners a right to immediate release under the Convention [22 25]. The ECtHR in Kaiyam v United Kingdom (2016) 62 EHRR SE 13 rejected the article 5(1) complaint in Kaiyam as inadmissible on the basis that article 5(1)(a) does not require a real opportunity for rehabilitation during the tariff period, since this represents the punishment part of the sentence. The ECtHR declined to adopt the UKSCs analysis, and adhered to the approach in James. On the facts of Kaiyam, a real opportunity for rehabilitation had been provided to the applicants [32 36]. Whether the UKSC should align its approach with the ECtHR The question of whether the obligation to provide rehabilitation opportunities arises under article 5(1) (as the ECtHR held in James and Kaiyam), or is immanent in article 5 as a whole (as the UKSC held in Kaiyam), affects the substance of the obligation, including: the period during which the obligation applies, the standard of the duty, and the weight to be placed on the Secretary of States assessment of what amounts to a reasonable opportunity [38 41]. In light of this, the UKSCs approach in Kaiyam has resulted in the imposition of a duty on the prison authorities which is significantly different from, and more demanding than, the duty imposed by the Convention. This position is a departure from the usual situation in which the jurisprudence of the UK and the ECtHR aligns. As to the UKSCs concern in Kaiyam, noted above, the ECtHRs approach does not entail an obligation under the Convention to secure the applicants immediate release, as other remedies exist which can remedy the lack of opportunity for rehabilitation [42 43]. Accordingly, the UKSC should now adopt the same approach to the interpretation of article 5(1)(a) as the ECtHR in James, and cease to treat the obligation to provide opportunities for rehabilitation as an ancillary obligation implicit in article 5 as a whole. It is noted, however, that a high threshold has to be surmounted in order to establish a violation of the obligation [44 45]. Application to extended sentences Whereas the previous cases on the duty to provide an opportunity for rehabilitation concerned life or IPP sentences, the present case concerns extended sentences, which may be imposed pursuant to section 210A of the Criminal Procedure (Scotland) Act 1995. An extended sentence comprises a custodial term and an extension period for which the offender is to be on licence beyond the licence period under the custodial term. A court may impose an extended sentence if it considers the licence period under the custodial term to be insufficient for the protection of the public. When the prisoner subject to the extended sentence is released on licence, the licence remains in force until the end of the extension period. The licence may be revoked if the offender commits a further offence [46 55]. The duty to provide an opportunity for rehabilitation established in James should apply equally to prisoners detained during the extension period of an extended sentence, having regard to the indefinite (albeit not unlimited) duration of detention during the extension period, its purpose of protecting the public from serious harm, and the possibility of change in response to opportunities for rehabilitation. The rationale in James that rehabilitation opportunities had to be available to IPP prisoners where they were detained solely because of the risk they pose to the public, applies to prisoners detained during the extension period of an extended sentence [59 63]. Application to the present case In light of the various opportunities for rehabilitation provided to the appellant in the present case, there can be no doubt that he was provided with a real opportunity for rehabilitation during his custodial sentence and his extended sentence. The appellant was not left in limbo without sentencing planning and without any attempt to provide him with an opportunity to rehabilitate himself. On the contrary, there were courses provided and completed, regular planning meetings, efforts made to find appropriate rehabilitative work, and transfers to less restrictive conditions. The problem which resulted in the appellants serving the whole of his sentence was not the failure of the prison authorities to provide appropriate courses, but his own misconduct. There is no question of his detention during the extension period, or at any other point during his sentence, having been arbitrary [65 85].