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.”
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.