A judge criticised a social department today for ignoring pleas from a child psychiatrist who said an 11-year-old boy needed to be taken into care.
Just weeks after Dr Stephen Westgarth wrote two letters to Sunderland City Council's social services department, the child raped a nine-year-old boy.
Judge Beatrice Bolton said the attack, which took place on June 8 in the Sunderland area, would not have happened if the defendant had been placed into care.
"It is a great pity that Dr Westgarth wrote to social services on March 23 recommending that you should be placed in care and that his letter appears to have been ignored," the judge told the defendant, as she passed sentence.
"He wrote again on May 26 and he received no reply and nothing happened.
"If something had happened and if you had moved away from home you would not have done this to the boy."
Newcastle Crown Court heard that the defendant raped the younger boy, who is disabled, after bribing him with Pokemon games.
He attacked him after luring him to his bedroom on the pretence of playing on his Xbox games console.
The defendant, who cannot be named for legal reasons, received four-and-a-half years detention with another three-and-a-half years on licence once he is released.
Penny Moreland, prosecuting, said: "The victim told police the defendant had invited him to come and play at his house on an Xbox.
"The two boys went upstairs to the defendant's bedroom, that's where the Xbox was."
She said the boy told police the defendant had said to him that if he let him carry out a sex act on him he would give him a Pokemon game.
Miss Moreland said that the attack took place on the defendant's bed and lasted for about 15 seconds.
"The boy told police it hurt but the defendant kept on doing it because the boy said he still wanted the Pokemon games," Miss Moreland said.
"The boy said it made him feel sad but he was trying his best because he wanted the Pokemon game.
"He went home for his tea and he began to cry and told his mother what he had done to him and his mother contacted the police."
Shortly afterwards the defendant's mother arrived at the victim's house, the court heard.
"She was horrified and expressed sympathy to the boy's mother and told her son she was going to phone social services to take him away," Miss Moreland said.
During police interviews the defendant said he had been raped himself several times before he attacked the nine-year-old.
However, the Crown is not pursuing these matters, as there was "no reasonable prospect of conviction", Miss Moreland said.
The court heard the attack had affected the victim and he began to self-harm to get attention.
"His mother describes profound changes in his personality," Miss Moreland said.
"He is now aggressive, angry, withdrawn and preoccupied with swearing and sexual matters."
The court heard that the defendant had been reprimanded earlier this year for common assault on a 16-year-old boy.
The boy, who cannot be named for legal reasons, sat in the dock accompanied by three detention centre officers.
Now aged 12, his parents were in court to see their son sentenced.
Gavin Doig, defending, handed the judge a letter the defendant had typed himself.
"All those that have seen him say that with support he will be able to respond to treatment," Mr Doig said.
"Clearly the time already spent in custody has been of great assistance to him.
"It appears his reading age has moved on 12 months in the last six months and his behaviour has got better."
Passing sentence, Judge Bolton said the defendant knew there was "something not quite right" with the victim, even if he did not know exactly what his disability was.
"The victim is a lot smaller and younger than you and you accept he had a disability and you also knew he liked Pokemon," she said.
"You told him you would give him a game if he took his trousers down. He was in a lot of pain but he tried to be brave because he wanted the Pokemon game."
The judge said that she accepted he had shown remorse and wanted to go home to his parents.
"I have read your letter and you very much want to go home," she said.
"You won't be going home until you are at least 14-and-a-half and even after that you are going to have to be very well behaved and not get into trouble with the police."
The judge said she was pleased the boy had been making progress in overcoming his problems while in care but at present posed a danger to the public.
She added: "The public had to know that until you learn all these things you are of significant risk of harm to others. Both the doctors and Youth Justice Board say so."
Judge Bolton also sentenced the boy to a 12 month conditional discharge after he admitted causing unnecessary suffering to two chickens after kicking them to death.
At an earlier hearing, the boy admitted a single charge of rape.
Jan van Wagtendonk, the independent chair of Sunderland Local Safeguarding Children Board, said: "Sunderland Safeguarding Children Board is undertaking a serious case review in respect of a young person in order to learn lessons from this case.
"The serious case review is an independently-chaired process with an independent overview author and partner agencies are not in a position to comment further until the executive summary report is published."