A woman has lost custody of her two sons after a family court judge said her "permissive parenting" had caused harm.
Judge Laura Harris ruled that the boys - aged 11 and 14 - should live with their father.
The judge said the woman had "significantly failed" the children.
Judge Harris said the boys' behaviour towards adults showed a "lack of discipline and structure" and added: "I consider the mother's parenting has been permissive, and, although the court must be tolerant of different standards of parenting, I consider the permissive parenting in this case has caused the children harm."
Detail of the case has emerged in a written ruling by the judge after a hearing in the Principal Registry of the Family Division of the High Court in London.
No one involved was named.
The couple separated in 2002 and in 2004 a court ruled that the children should live with their mother - and have weekend contact with their father.
But in 2012 the man asked a court to allow the boys to live with him - complaining that contact was "regularly refused".
He told Judge Harris that he was concerned about his ex-wife's mental health and thought that she showed signs of manic depression.
The man said he was worried about his sons' dental and medical needs being neglected, and that they were "left to play computer games" and had "irregular bedtimes".
He described his ex-wife as more of a "best friend" to the boys than a parent and said she would let the children "do what they like".
The woman said she had "gone out of her way" to promote a relationship with her ex-husband and his family. She said the boys had an "impeccable record" at school and were "good boys with beautiful manners".
But Judge Harris ruled in favour of the man and ordered a residence transfer - although she said the woman should have contact.
The judge said the man's frustration was "palpable".
"He has been tenacious to the extent of being dogged in his pursuit of a relationship with his sons. I do not criticise him for his tenacity. Many fathers would have given up by now," said Judge Harris.
"He has, in my view, demonstrated far better insight into the needs of his teenage and pre-teenage boys, for example, around issues of guidance and boundaries, than the mother. Their parenting styles are very different.
"He is much more in favour of structure, boundaries and discipline, and I can understand why the boys might baulk at that, given what I consider to have been the very permissive atmosphere in which they have lived at home.
"He is totally committed to his sons. He has given his proposals a great deal of thought, and I was impressed with the breadth of the proposals and their depth. I was impressed with how he said he would deal with difficulties, for example, if either of the boys ran away. His analysis of what he saw facing the boys if they stayed with their mother was insightful."
The judge said the woman was "very angry and wilful" - an attitude fuelled by a belief that the man had an affair before their marriage ended.
"Her hatred of the father is almost pathological," said Judge Harris.
"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.
"That is not to say that she does not love her children, I have no doubt she does, although I find her love to have something of a possessive quality about it."
The judge added: "I consider that 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. Further, I have real concerns about her as a role model.
"I am sad to come to the conclusion that I find on all these fronts this mother has significantly failed these boys."