Judge Clifford Bellamy said Leicester City Council had not undertaken a "robust risk assessment" of the boy's great-great-uncle who had been jailed for sexual abuse.
The city's family court heard the nine-year-old had a "complex" home life.
The judge said the boy should be placed into foster care.
A city council spokesman said the child has already been moved to an "appropriate placement."
The judge explained in a written ruling the boy's mother had mental health problems and separated from his father several years ago and was now in a lesbian relationship.
His father has dwarfism, an alcohol problem and had been convicted of having unlawful sex with a 16-year-old girl when he was 21.
Updates from this story and more from Leicestershire
The boy had been living in the care of his great-great-uncle, who was in his 70s, who had been given an eight-year jail term in the early 1990s.
He had admitted unlawful sexual intercourse and a serious sexual offence with his niece when she was aged between 11 and 13.
Judge Bellamy said the man had been released on licence after serving five years and was assessed as "low risk".
The concerns were raised after the judge was asked to make decisions about the long-term future of the boy at the hearing.
He said the council had lacked "any sense of urgency" in bringing the case to the attention of a family court judge.
A city council spokesman said: "This case does not appear to have been handled appropriately, or with the urgency required, and our own review is under way.
"We have already put in place new systems to improve and oversee the way assessments are carried out, and further work is under way to ensure court proceedings are expedited."
The judge also ruled that none of those involved in the case could be identified.
Social services staff have been criticised after a boy spent two years living with a relative who was a convicted paedophile.