APPEAL COURT, HIGH COURT OF JUSTICIARY
 HCJAC 37
Lord Justice Clerk
OPINION OF THE COURT
delivered by the LORD CARLOWAY, the LORD JUSTICE CLERK,
APPEAL AGAINST CONVICTION AND SENTENCE
CRAIG McLEOD McMURDO
HER MAJESTY’S ADVOCATE
Appellant: J Keenan, Solicitor Advocate; Capital Defence
Respondent: R Goddard AD; the Crown Agent
26 March 2015
 On 22 May 2014, after a trial lasting 8 days at the Sheriff Court in Edinburgh, the appellant was found guilty, by unanimous verdicts of the jury, of: (charge 1) causing a 13 year old girl to participate in sexual activity by inducing her to send him images and videos of her naked and masturbating, contrary to section 31 of the Sexual Offences (Scotland) Act 2009; (charge 2) causing the girl to look at naked images of himself and other unknown males, contrary to section 33 of that Act; (charge 3) sending sexually explicit text messages to the girl, contrary to section 34(1) of the Act; and (charge 5) having in his possession indecent photographs of children, contrary to the Civic Government (Scotland) Act 1982, section 52A(1).
 On 19 June 2014, the sheriff imposed an extended sentence (Criminal Procedure (Scotland) Act 1995, s 210A) of 60 months, 30 months being the custodial element, in respect of charge 1 and 18, 12 and 15 months imprisonment respectively on charges 2, 3 and 5. All the sentences were ordered to run concurrently.
 The appellant’s home address and place of work were searched by the police under warrant on 23 October 2012. Various computers were recovered. These contained indecent images and videos of the complainer at levels 1 and 2 on the approved scale (see HM Advocate v Graham 2011 JC 1, LJC (Gill) at para ). Thousands of downloaded indecent images and videos of other children, ranging from level 1 to 5, were also discovered. The fact that the images were of children and indecent was a matter of agreement. The mobile phones of the appellant and the complainer revealed that they had sent each other sexually explicit messages, videos and texts throughout a period of about a year. The appellant and the complainer never met.
 The appellant gave evidence that he did not know, and could not reasonably have known, that there were indecent images of children (other than the complainer) contained on his devices. In that respect, he depended upon the statutory defence under section 52A(2)(b) of the 1982 Act (infra). The images, which were found on the appellant’s computers and a memory stick, had been deleted and were recoverable only by the use of specialist software. There was no evidence that the appellant had such software available to him, although it was accepted that the computers and stick did belong to him. There was evidence about the periods during which he had access to these devices, the password protection he used and the periods during which the images were downloaded.
Appeal against conviction
 The ground of appeal against conviction on charge 5, for which leave has been granted, is that the sheriff did not adequately direct the jury on the burden of proof applicable to the defence under section 52A(2)(b) of the 1982 Act. The section, so far as relevant, provides that:
“(1) It is an offence for a person to have any indecent photograph … of a child in his possession [emphasis added];
(2) … it shall be a defence for him to prove –
(a) that he had a legitimate reason for having the photograph … or
(b) that he had not himself seen the photograph … and did not know … it to be indecent; or
(c) that the photograph … was sent to him without any prior request … and that he did not keep it for an unreasonable time.”
 When it came to directing the jury, the sheriff gave the standard directions on the need to be satisfied of the appellant’s guilt beyond reasonable doubt. He went on to explain that there was no standard of proof to be met by the defence and that, if the jury believed any evidence which “cleared” the appellant, then they required to acquit. Even if they did not completely believe the defence, if it raised a reasonable doubt, they must also acquit. Specifically, in relation to the offence in charge 5, he told the jury that, for a conviction, they had to be satisfied that the appellant had “possession” of the images and that this involved proof of knowledge, that he had the images on his computer, and control, in the sense of being able to access them. The jury had to be satisfied that the appellant had been aware that he had images on his computer or memory stick. The sheriff advised the jury of the defence proffered by the appellant that he had not seen the photographs and had no reason to know that they were indecent. He concluded with a general direction that if the jury believed the appellant then they required to acquit. Even if they did not wholly believe him, if his evidence provided a reasonable doubt they must also acquit.
 The contention for the appellant was that the sheriff had given inadequate directions because he did not tell the jury specifically that, once the statutory defence had been raised, it was for the Crown to negative that defence beyond reasonable doubt. The sub-section setting out the defence placed only an “evidential” burden on an accused and not a “legal” or “persuasive” burden (see Glancy v HM Advocate 2012 SCCR 52, Henvey v HM Advocate 2005 SCCR 282, following R v Lambert  2 AC 545).
 The advocate depute maintained that the sub-section imposed a legal burden on the accused to prove the defence on a balance of probabilities (Sheldrake v DPP  1 AC 264). In determining whether that were so, or whether only an evidential burden arose, each provision had to be looked at in its context having regard to the guarantees in Article 6 of the European Convention (McLean v Carnegie 2006 SLT 40 at para ). The wording used supported an interpretation that a legal burden had been created. The interpretation should be given effect to unless deemed incompatible with Article 6.2 of the Convention (R v Johnstone  1 WLR 1736 at paras 44-46). The interference with the presumption of innocence was justified having regard to the aim of the legislation to protect children (R v Land  QB 65). The appellant had an opportunity to prove that he was unaware of the nature of the images; a matter peculiarly within his own knowledge (Sheldrake (supra) at para 41; Adam v HM Advocate 2013 SCCR 209 at para ).
 The offence here was not as serious as that under the drugs legislation (Sheldrake (supra) at para 26). The Crown retained the onus of proving not only that the accused was in possession of the discs or memory sticks, but that he knew that they contained images over which he had control (Atkins v DPP  1 WLR 1427 at 1440; Harris v HM Advocate 2012 SCCR 234 at paras -). The courts in England and Wales had interpreted the equivalent legislation (Criminal Justice Act 1988, s 160(2)) as imposing a legal burden (R v Collier  1 WLR 843 at para 18; AG’s Reference No.1 of 2004  1 WLR 2111; R v Leonard  2 Crim App R 12 at paras 8 and 9). In any event, the sheriff’s directions had favoured the appellant.
 Whether a statutory defence carries with it a legal (reverse) onus or only an evidential burden depends upon an interpretation of the particular provision, the activity prohibited and whether a departure from the normal incidence of the presumption of innocence is justified, balancing the interests of the public with the rights of the individual. An analysis of this subject has been recently been carried out in Adam v HM Advocate 2013 JC 221 (Lord Menzies at para  et seq applying Glancy v HM Advocate 2012 SCCR 52). It is sufficient to adopt that analysis. Thus, in certain situations, it may be determined that a legal burden is created (Criminal Law (Consolidation) (Scotland) Act 1995, s 49(4), see Hill v HM Advocate 2014 SCCR 659; Licensing (Scotland) Act 1976, s 71; see McLean v Carnegie 2006 SLT 40; Dangerous Dogs Act 1991, s 3(2), Adam v HM Advocate (supra)). In others, the nature of the offence created may be such that only an evidential burden is raised (Misuse of Drugs Act 1971, s 28(2), Henvey v HM Advocate 2005 SCCR 282, following R v Lambert  2 AC 545).
 Under section 52A of the Civil Government (Scotland) Act 1982, the prosecution must establish not simply that the appellant had images on his computers or devices, but that he knew of the existence, and had control, of the images themselves. That knowledge and control requires proof beyond reasonable doubt. The presumption of innocence thus, of course, applies. It is a proportionate response, to the need to deter the proliferation of child pornography, not to require the prosecution to prove that the appellant had looked at the images (that being a matter peculiarly within his own knowledge) but to provide a defence, sustainable on the balance of probabilities that he had not done so. In these circumstances, the clear intention of Parliament, upon a plain reading of the provision, that a legal (reverse) onus is thus created, must be endorsed. The court is reinforced in its view by the same conclusion having been reached in England and Wales (R v Leonard  2 Cr App R 138; R v Collier  1 WLR 843).
 It follows that the sheriff erred in failing to direct the jury that, once possession and control of the images were established beyond reasonable doubt, the onus transferred to the appellant to prove, on a balance of probability, that he had not accessed the images. The guidance in the Jury Manual (para 60.B.2) to this effect is correct. The sheriff’s directions were in favour of the appellant since they effectively kept the onus on the Crown throughout to prove not only knowledge and control of the images, but also awareness of their content. The appeal against conviction on charge 5 must accordingly fail.
Appeal against Sentence
 Prior to the hearing, the appellant abandoned that part of his appeal (ground 4) which challenged the length of the custodial sentences as excessive. He advanced only his contention (ground 5) that the extended nature of the sentence on charge 1 was “unnecessary and inappropriate”. In oral submissions, this came close to saying that the test under section 210A of the Criminal Procedure (Scotland) Act 1995 had not been met. That test required the sheriff to be satisfied, in short, that the appellant would continue to pose a risk of “serious harm” upon release from a conventional custodial disposal, such that the ordinary licence conditions would “not be adequate” to afford protection to the public.
 Despite the clear terms of ground 5 in the Note of Appeal, the sheriff provides very little specific justification for the selection of an extended sentence other than a reference in the Criminal Justice Social Work Report that the court may wish to consider a period of post release supervision. Although the CJSWR reported that the appellant was unlikely to offend generally, it did state that he was at “low/moderate” likelihood of sexual reoffending due to his age, limited offending history and the nature of the offence. The CJSWR also highlighted the problem of carrying out an accurate assessment of risk caused by the appellant’s continuing denials in relation, presumably, to the images (other than of the complainer) found in his possession.
 It is of course for the sheriff to assess whether a convicted person poses a “serious harm” risk. The content of a CJSWR is only one factor, albeit that it will normally be a significant one, in the sheriff’s consideration. However, in the absence of a reasonable clear justification from the sheriff, the selection of an extended sentence must be regarded as excessive. The court will accordingly allow the appeal against sentence to that extent and quash the extended element.