The 16-year-old boy accused of killing Alesha MacPhail told a "pack of lies", jurors have heard.
Prosecutor Iain McSporran QC said there was a "mountain of evidence" against the boy, who denies abducting, raping and murdering Alesha last July on the Isle of Bute.
In his closing speech at the High Court in Glasgow, Mr McSporran urged the jury to find the teenager guilty.
The accused's QC, Brian McConnachie, said the boy should be acquitted.
Mr McSporran told jurors that they had listened to "one of the worst cases" a jury has had to hear.
He said the case would provoke "revulsion", but said these emotions could "play no part in the process".
He said the court was dealing with an "extraordinarily important matter".
During the trial, the court heard Alesha suffered 117 injuries and that she had been "brutalised".
Her naked remains were discovered in the grounds of the former Kyles Hydro Hotel on Bute on 2 July.
Mr McSporran said the case had involved "deeply disturbing and distressing" evidence as well as "dreadful" photos.
The advocate depute said: "Something terrible was done to that girl."
The teenager has lodged a special defence claiming the crime was committed by Ms McLachlan, 18, who is the girlfriend of the victim's father.
'Pack of lies'
The court previously heard the accused claim he had sex with Ms McLachlan, who then planted his DNA - from a used condom - at the scene.
The boy claimed that he later told police of going for cannabis that morning, so no-one would know about him and Ms McLachlan being together.
But, Mr McSporran said: "He spun a yarn, a pack of lies. He has also told a pack of lies in the witness box."
The boy had also claimed that Ms McLachlan may have been "fantasizing" about harming Alesha.
The advocate depute said no-one else had come up with that suggestion.
He added: "He introduced that into evidence. It was his comment, his word."
The advocate depute claimed that what the boy had suggested was "preposterous".
In her evidence, Toni McLachlan denied any part in the murder, insisting she "loved" Alesha.
'Not a whodunnit'
Mr McSporran told the jury the boy had "more than enough time" that morning to carry out the crime.
He concluded by asking jurors to find the boy guilty and said there was a "mountain of evidence" against the teenager.
In the closing speech for the defence, Mr McConnachie said: "There will be people sitting out there who would return a verdict of guilty after reading the indictment, just by the nature of the charge - but that would be wrong."
The QC added it was not a case of the teenager versus Toni McLachlan.
He said: "This is not a whodunnit."
Mr McConnachie suggested that, if guilty, the boy had gone into the MacPhail family home at night, where there were four adults.
"He then chances upon the room where Alesha is and opens a squeaky door to gain entry, goes in and, whatever condition Alesha is in, he picks her up and took her out.
"A girl, according to Toni McLachlan, who would scream if a stranger came into the room."
The QC also accused the prosecution of "trying too hard to make something out of nothing".
As the defence closed its case, a friend of Ms McLachlan said she had told her that Alesha was "in a better place".
Lindsay Calderwood said the comment was made in the days after the child was found dead.
The jury also heard from a neighbour who claimed Alesha's father had attacked his partner.
Avril Lax said the abuse happened over a three-month period in the flat Robert MacPhail, 26, shared with his parents.
She told the court she also raised her concerns with Robert's parents, Calum MacPhail and Angela King.
The court previously heard that Robert MacPhail was on bail for a domestic charge.
But in evidence Ms McLachlan said the matter concerned a heated argument the couple had after a funeral and did not turn physical.
The trial continues.
What the trial has heard so far
- Boy, 16, denies killing six-year-old girl
- DNA found on Alesha 'matched accused'
- Alesha trial told of DNA Google search
- Alesha accused had 'fantasy' killing chat
- Alesha, six, had 'catastrophic' injuries
- Woman denies killing six-year-old Alesha
- Alesha's father 'sold cannabis to accused'
- Boy accused of Alesha murder blames woman
Why is the BBC not naming the accused?
It is illegal in Scotland to publish the name, address, school or any other information which could identify anyone under the age of 18 who is the accused, victim or witness in a criminal case
This law applies to social media as well as to websites, newspapers and TV and radio programmes.
However, the name of victims who have died can be published - so the BBC and other outlets are able to identify Alesha MacPhail.
How can an accused blame someone else for the crime?
Ahead of their trial, the accused can lodge a special defence such as self-defence (they were defending themselves from attack), alibi (they were somewhere else when the crime was committed) and mental disorder (the accused is not responsible for their actions because they were suffering from a psychiatric condition).
In this case, the accused has lodged a special defence of incrimination, which means he has claimed that someone else (Toni McLachlan) was responsible.
However, the Crown must still prove the guilt of the accused beyond reasonable doubt. There is no onus on the accused to prove their special defence is true, and he or she can still be acquitted even if the jury does not believe their special defence.