The man accused of murdering 12-year-old Tia Sharp had a "sexual attraction" towards the schoolgirl and assaulted her before she was killed, a court has heard.
The jury was also told the accused, Stuart Hazell, had images and films of Tia on a memory card and her blood was found on a sex toy at her grandmother's house, where her body was found.
Hazell, 37, is accused of murdering the schoolgirl last August and hiding her body in the loft of her grandmother's property.
The suspect, of New Addington in South London, is the former boyfriend of Tia's grandmother. During the opening day of the trial at the Old Bailey, the court said how the 37-year-old was in essence her "step-grandfather".
Hazell denies murdering Tia last year. She disappeared on 2 August but wasn't found until the 10th, when her body was discovered in the loft.
During the first day of the trial, Tia's mother broke down in tears and shouted "I hope you rot" at Hazell after the court was shown what appears to be a secret recording from Hazell's memory card of Tia rubbing cream into her leg.
The two memory cards recovered by police from Hazell also contain 11 still images of Tia sleeping, and three video clips of her sleeping in her bedroom.
The court previously warned the jury that some of the evidence in the case might be "distressing".
The prosecution told the court that Tia had died a "sudden and violent death" after she was sexually assaulted by Hazell.
The prosecution also accused Hazell of taking a photo of a "dead, naked, pre-pubescent girl" in Tia's bedroom at her grandmother's home on 3 August - around the time she was reported missing.
Hazell had also searched for child pornography and incest porn on his phone in the days after he allegedly killed her and hid her body in the loft, the jury was told.
The prosecution told the jury they must decide if the 12-year-old was accidently killed by Hazell or not.
Andrew Eadis QC, prosecuting, told the jury: "The prosecution case is that Stuart Hazell had a sexual attraction for Tia Sharp, that there was some form of sexual assault, something of that kind, and that was the reason he killed her.
"The issue in the end for you to decide will be this. Has the evidence made you sure that Tia Sharp was murdered or do you think it may have been an accident?
"What we know is that after she died he put her in the loft. That's not what you would normally do with someone who has suffered an accident. Generally speaking, if someone has an accident and you are concerned about their health you call an ambulance."
Eadis told the jury that the loft had been inspected by police twice before Tia's body was finally found. He added: "They only found it, I am afraid, because it had started to smell."
The trial continues.