In custody hearings, the court is required to look at what is in the best interest of the children. And by VA statute it states the following
§ 20-124.3. Best interests of the child; visitation.
In determining best interests of a child for purposes of determining custody or visitation arrangements including any pendente lite orders pursuant to § 20-103, the court shall consider the following:
1. The age and physical and mental condition of the child, giving due consideration to the child's changing developmental needs;
2. The age and physical and mental condition of each parent;
3. The relationship existing between each parent and each child, giving due consideration to the positive involvement with the child's life, the ability to accurately assess and meet the emotional, intellectual and physical needs of the child;
4. The needs of the child, giving due consideration to other important relationships of the child, including but not limited to siblings, peers and extended family members;
5. The role that each parent has played and will play in the future, in the upbringing and care of the child;
6. The propensity of each parent to actively support the child's contact and relationship with the other parent, including whether a parent has unreasonably denied the other parent access to or visitation with the child;
7. The relative willingness and demonstrated ability of each parent to maintain a close and continuing relationship with the child, and the ability of each parent to cooperate in and resolve disputes regarding matters affecting the child;
8. The reasonable preference of the child, if the court deems the child to be of reasonable intelligence, understanding, age and experience to express such a preference;
9. Any history of family abuse as that term is defined in § 16.1-228 or sexual abuse. If the court finds such a history, the court may disregard the factors in subdivision 6; and
10. Such other factors as the court deems necessary and proper to the determination.
The judge shall communicate to the parties the basis of the decision either orally or in writing. Except in cases of consent orders for custody and visitation, this communication shall set forth the judge's findings regarding the relevant factors set forth in this section.