The father of murdered six-year-old Alesha MacPhail sold cannabis to the teenager accused of killing her, a court has heard.
Robert MacPhail, 26, told the High Court in Glasgow he had done deals with the 16-year-old.
The schoolgirl was found dead in woodland in July last year on the Isle of Bute.
She had been spending a summer break with her father and grandparents in the house they shared.
The accused, who cannot be named because of his age, denies taking her from her bed before raping and murdering her on July 2 last year.
Alesha's father identified him in the courtroom and told the jury: "I used to sell him cannabis."
Read more: Alesha MacPhail murder trial shown images of schoolgirl's body
Mr MacPhail, who is unemployed, said he had last sold him the drug a few months before Alesha's murder.
He said he stopped after the teenager's mother told his partner, Toni McLachlan, to stop.
The court heard the deals usually took place at a bus shelter across from his own mother's house in Ardbeg Road, where he then lived along with Ms McLachlan, 18.
The pair were in bed on the morning of July 2 when Alesha's grandparents came in to say she was missing, and all four began hunting around the house and outside for the schoolgirl.
Mr MacPhail said he had put his daughter to bed the night before with a Peppa Pig DVD.
"I told her I would see her in the morning and that was the last time I saw her," he said.
Mr MacPhail said his relationship with Alesha's mother Georgina Lochrane in Coatbridge, North Lanarkshire, had broken down months after she was born.
He said he saw his daughter every second weekend and during the holidays.
Mr MacPhail said his daughter "loved" spending time on his home island, going to the beach and playing at the park.
Asked about Alesha's relationship with Ms McLachlan, he said it was "great".
"They both loved each other to bits," he said.
The 16-year-old accused of Alesha's murder has lodged a special defence blaming Ms McLachlan for her death.
He also denies attempting to defeat the ends of justice by disposing of clothing and a knife.
The trial continues.
Why are you making commenting on The Herald only available to subscribers?
It should have been a safe space for informed debate, somewhere for readers to discuss issues around the biggest stories of the day, but all too often the below the line comments on most websites have become bogged down by off-topic discussions and abuse.
heraldscotland.com is tackling this problem by allowing only subscribers to comment.
We are doing this to improve the experience for our loyal readers and we believe it will reduce the ability of trolls and troublemakers, who occasionally find their way onto our site, to abuse our journalists and readers. We also hope it will help the comments section fulfil its promise as a part of Scotland's conversation with itself.
We are lucky at The Herald. We are read by an informed, educated readership who can add their knowledge and insights to our stories.
That is invaluable.
We are making the subscriber-only change to support our valued readers, who tell us they don't want the site cluttered up with irrelevant comments, untruths and abuse.
In the past, the journalist’s job was to collect and distribute information to the audience. Technology means that readers can shape a discussion. We look forward to hearing from you on heraldscotland.com
Comments & Moderation
Readers’ comments: You are personally liable for the content of any comments you upload to this website, so please act responsibly. We do not pre-moderate or monitor readers’ comments appearing on our websites, but we do post-moderate in response to complaints we receive or otherwise when a potential problem comes to our attention. You can make a complaint by using the ‘report this post’ link . We may then apply our discretion under the user terms to amend or delete comments.
Post moderation is undertaken full-time 9am-6pm on weekdays, and on a part-time basis outwith those hours.
Read the rules here