A 32-year-old woman has regained the care of her four sons after having a "light bulb moment", a senior family court judge said.
The youngsters had been placed into foster care seven months ago, Mr Justice Moor heard.
Council social workers said the woman had exposed her children to domestic violence, and her life had been characterised by relationships with abusive men.
But the judge said the woman has taken a "long, hard look", and he has approved the children's return to her care under the supervision of social services staff.
"I consider the 'light bulb' moment in this case was when the children were removed from (her) care," said Mr Justice Moor.
"She knew she had to work hard to get them back and she has done so.
"She had been stressed by the trauma of separation."
The judge said he could not be sure the woman would not enter "another inappropriate relationship".
But he said he is satisfied she would tell social workers if she met a new man.
Mr Justice Moor, who is based in the Family Division of the High Court, has revealed detail of the case in a ruling after a private hearing.
He has not identified anyone involved.