This appeal concerns provisions of the Mental Health (Care and Treatment) (Scotland) Act 2003 (the Act) designed to address the problem of entrapped patients, namely those who no longer require the level of security afforded by the state hospital but for whom appropriate local services are not available [3 11]. The appellant, G, was tried for rape, assault and breach of the peace in 1998 and acquitted on the ground of insanity. He is detained at the state hospital at Carstairs under a compulsion order and a restriction order. G made an application under section 264(2) of the Act. It provides that the mental health tribunal may, if satisfied that the patient does not require to be detained under conditions of special security that can be provided only at the state hospital, make an order (a) declaring that he is being detained in conditions of excessive security, and (b) specifying a period not exceeding 3 months during which certain duties shall be performed [28 29]. These include the identification of a hospital, which is not a state hospital, in which the patient could be detained in appropriate conditions and in which accommodation is available for him [31]. Decisions under section 264(2) are among those functions that must be discharged having regard, insofar as relevant, to the matters set out at section 1(3) of the Act. These include the wishes and feelings of the patient (s.1(3)(a)), the importance of providing the maximum benefit to him (s.1(3)(f)), and the need to ensure that, unless it can be justified, he is not treated less favourably than a non patient in a comparable situation would be (s.1(3)(g)) [12 18]. Section 1(4) provides that the function must be discharged in the manner that appears to the person discharging it to involve the minimum restriction on the freedom of the patient that is necessary in the circumstances, after having regard to matters including those in section 1(3) and such other matters as are relevant in the circumstances [22]. Gs application was refused. At the first stage of its section 264(2) analysis, the tribunal found G did not require to be detained under conditions of special security that could be provided only at the State Hospital. At the second stage, when considering whether to exercise its discretion to make an order, it had regard to section 1, referring in particular to maximum benefit (section 1(3)(f)) and to the least restrictive option (s.1(4)). It did not expressly mention the other provisions of section 1(3), (5) or (6). It found [47 53] that he had recently been subject to the lowest level of security at Carstairs. He continued to pose some risk of sexual violence towards women and the best way of managing it could only be determined once he had undertaken and completed satisfactorily a course of psychological treatment for sexual offending. The psychology department at Carstairs was best placed to deliver this treatment, and the tribunal was concerned that G was less likely to engage in it in a medium secure hospital. Consequently, there was a significant risk that he would become trapped in the medium secure system. The risk he posed meant he would need to be subject to greater restrictions on his movements in a medium secure hospital than at Carstairs unless and until he completed the necessary treatment, which could take 12 to 18 months. There was a significant risk of consequential mental health problems. The tribunal found that it was of maximum benefit to G that he remain at Carstairs. Gs appeal to the Court of Session was refused. Before the Supreme Court, he argues that the tribunal: (i) failed to exercise its discretion in accordance with the purpose of section 264: subsection (2) should be interpreted as conferring only a residual discretion to refuse an order in exceptional circumstances at stage 2 where a decision favourable to the application had been reached at stage 1; (ii) was influenced at stage 2 by the risk G posed to women, when consideration of risk ought to have been confined to stage 1; (iii) placed weight on the unavailability of suitable resources elsewhere an irrelevant factor; (iv) failed to have regard to his wishes and feelings and to the need to avoid discrimination; and (v) elevated the importance of providing maximum benefit (s.1(3)(f)) above the least restrictive alternative principle (s.1(4)). The Supreme Court unanimously dismisses the appeal. Lord Reed, with whose judgment the other Justices agree, addresses each ground of appeal as follows: (i) The tribunal understood that section 264(2) involved two stages and what those stages were. Once stage 1 is satisfied, the application should be granted unless there is some good reason to refuse it [41]. The range of matters the tribunal may take into account is necessarily wide but its discretion must be exercised consistently with the intention of Parliament. There is no legal reason why it is only in exceptional circumstances that an application should be refused at stage 2 [55]. (ii) Given the nature of a section 264 decision, risk is plainly relevant at each stage of the process. The increased risk to women which might result from a transfer to a medium secure hospital where there would be female patients was a relevant matter falling within section 1(4)(c). The finding that the risk would result in greater restrictions in the medium secure unit was plainly relevant to the tribunals section 1(4) assessment, and it was also entitled to have regard, under section 1(3)(f), to the consequential risk to Gs mental health [57]. (iii) Although the unavailability of accommodation does not preclude the granting of an application [38; 42], this does not mean the comparative quality of treatment available at other hospitals is irrelevant. The tribunal is not prevented from taking into account a clinical comparison [59 61]. (iv) Whilst it did not mention them, it is clear that the tribunal had regard to Gs wishes and feelings insofar as relevant, in particular his wish to be transferred to a medium secure hospital and his attitude towards different forms of treatment. In relation to section 1(3)(g). Lord Reed rejects the argument that the provision is irrelevant to the discharge of the section 264 function since a patient is not comparable to a person of full capacity. It is undoubtedly relevant, but it was enough that the tribunal dealt with the critical issues sufficiently to enable the parties and the court to understand why the application had been refused. A formulaic rehearsal of every matter in section 1 was not required [64]. It is not readily apparent that the tribunal understood the structure of section 1. On the facts of this (v) case, however, this cannot have affected the substance of its decision. It appears most likely that it did not reach a clear conclusion on section 1(4). In those circumstances, it was entitled to exercise its discretion having regard to all relevant matters and in accordance with the objects of the Act. Its conclusion that it would be of maximum benefit for G to remain in the State Hospital was reasonable [65 67]. In a short concurring judgment, Lady Hale agrees with a degree of reluctance that the appeal should be dismissed. She shares Lord Reeds view [43] that it would be unreasonable to make a section 264 order where there was no conceivable possibility of an appropriate bed being found elsewhere, but stresses that such a conclusion is one that a tribunal should be slow to reach. One must beware the Catch 22 where the patient does not need a high level of security but the facilities offered are not suitable to the level of security he does need by reason of a lack of appropriate work done with him in the state hospital. In this case she agrees with Lord Reed that the tribunal was entitled to reach the factual conclusion that the patients therapeutic needs would be better met in the state hospital.