A trial was set for February 2019, with Iain McSporran QC acting as prosecutor and Brian McConnachie QC acting as Campbell's defence advocate. A second charge of attempting to defeat the ends of justice was dropped during the trial. Because he was younger than 18, the media were banned from reporting Campbell's name for the duration of the trial. The trial began on 11 February 2019, presided over by Judge Lord Matthews. The court was shown CCTV footage, from cameras installed by Campbell's mother, that captured the defendant leaving his house at 01:54 on 2 July, returning at 03:35, then leaving and returning again for two short periods before 04:07. Additional CCTV footage, supplied by members of the public, showed an individual walking along the shoreline at 02:25 and 02:26, appearing to carry something in his arms. Pathologist John Williams testified that MacPhail's feet were clean and uninjured, suggesting she had been carried. Janette Campbell confirmed that several items recovered from the beach after MacPhail's death – a fleece jacket, jogging bottoms, boxer shorts, a t-shirt, and a kitchen knife – belonged to her son and came from her kitchen. Fibres from the trousers were found on MacPhail's discarded pyjamas, and forensic scientist Stuart Bailey testified that DNA matching the accused was found on the beach clothing. He further confirmed that a DNA sample taken from MacPhail's neck had a billion-to-one chance of coming from anybody but Campbell. DNA matches were also found on MacPhail's face, 14 parts of her body, and some of her clothing. A cybercrime expert told the court that on 3 July 2018, Campbell used his phone to Google search "How do police find DNA", then visited a webpage titled "Collecting DNA evidence". A 16-year-old girl testified that hours after MacPhail's body was discovered, Campbell filmed himself in a Snapchat video, sent to a group of 25 people, with the words "Found the guy who has done it." In his defence, Campbell claimed that he spent the early hours of 2 July procuring cannabis and searching for his lost phone. Two young men testified that they had received messages from the defendant but did not meet him that night. Campbell logged a "special defence of incrimination", in which he argued that Toni McLachlan was responsible for MacPhail's death. He took the witness stand and claimed that McLachlan had sex with him in a garage that night; he then suggested that she murdered MacPhail and used the condom to plant his semen on the child's body.