A mother who acted more like her children's friend than their parent has been ordered to hand them over to their dad.
A judge decided that the mum had harmed her sons, aged 11 and 14, by 'permissive parenting'.
The boys, who lived with their mother after their parents' break-up, were staying up late, missing school, late for classes and neglecting their homework.
Their mum spent much of the day in bed while her sons were left to play computer games.
Judge Laura Harris said the mother was 'complacent about the educational issues and minimised concerns about lateness, homework and general progress'.
The judge said she thought it likely that the mother was depressed, because she spent 'hours under the duvet, on the phone or using her iPad, and the children are left to their own devices'.
The judge added: "It seems to me to be likely that they are spending a lot of time playing on their own or on their Xboxes.
"She does have a very permissive style of parenting, and I accept the father's evidence that she is more like a friend than a parent.
"I am satisfied that there is a failure to provide proper guidance and boundaries essential for the social and emotional development of these pre-adolescent and adolescent boys."
Judge Harris, sitting in the Family Division of the High Court, said in her ruling – which has been published with the parents and children un-named – that the 41-year-old mother had 'significantly failed' her sons.
After hearing from a senior teacher and a court-appointed social worker, she said that the older boy 'is not achieving his educational potential, which is harmful to his future prospects'.
The judge added that there was a risk the younger brother would 'go the same way'.
The boys' behaviour 'shows a lack of discipline and structure,' the judge said.
She added: "Although the court must be tolerant of different standards of parenting, I consider the permissive parenting in this case has caused the children harm."
Judge Harris said the mother deeply resented the father, who she believed had begun an affair before their marriage broke up in 2002, and who she believed had failed to pay properly for his sons' upbringing.
She was awarded custody in 2002, and in 2004 a court ruled that the children should live with their mother while having weekend contact with their father.
In 2012, the father asked a court for custody after repeatedly complaining that he had been denied contact with them.
Judge Harris said the father 'has, in my view, demonstrated far better insight into the needs of his boys'.
She said: "He is much more in favour of structure, boundaries and discipline, and I can understand why the boys might baulk at that."
Judge Harris said the mother had manipulated the boys into hostility towards their 43-year-old father and that her hatred of him was 'almost pathological'.
Judge Harris added: "So preoccupied is she with her own sense of grievance that she completely overlooks the effect of her behaviour on her children. In my judgment, she has prioritised her own needs and feelings at the expense of the needs of her children."