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 2 July last year.
Alesha’s father identified him in the courtroom and told the jury: “I used to sell him cannabis.”
MacPhail, who is unemployed, said he had last sold the defendant 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 McLachlan, 18.
The pair were in bed on the morning of 2 July when Alesha’s grandparents came in to say she was missing, and all four began hunting around the house and outside for the schoolgirl.
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.
Jurors were shown pictures of Alesha’s naked body lying on the ground and some clothing nearby.
The jury heard previously that shorts, pants and a vest were recovered a short distance from her.
Images were also shown to the court of the attic flat where she was staying with her grandparents and father, including Alesha’s bedroom.
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.
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 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 McLachlan for her death.
He also denies attempting to defeat the ends of justice by disposing of clothing and a knife.
The trial continues.