I just read a study (the largest ever) involving entire generations and thousands of children taken from troubled homes into foster care.
The study suggests quite strongly children who were left in troubled homes but received weekly counselling (both child and parents) faired quite dramatically compared to children removed and placed into foster homes.
One out of three children left to foster care, (no matter how good the home is), were more likely to display problems with interpersonal skills, from neurotic behaviour to dropping out of school and attaining a criminal record by the time they reach 18. In fact, statistically speaking, the psychological damage is similar to those taken as kids into missions of the church.
This study conclusively states, except for cases of extreme neglect such as sexual, physical or mental abuse, that leaving a child in a troubled home (but receiving counselling) fair a lot better than taking a child away from its home and putting them into foster care no matter howe well intended or how good the home is.