If the discerning boy opts for his father, he lives with him day and night so the father can protect, instruct, and discipline him. The father may not bar the child from visiting his mother, for such deprivation breeds filial disobedience and severing of kinship ties. Should the boy choose his mother, he stays with her at night but spends the daytime with his father for education and discipline. If he declares no preference, the matter is settled by drawing lots, since neither parent has precedence over the other except through this method.
As for a girl, once she reaches seven years of age she remains with her father until her husband assumes responsibility for her, because he is better able to safeguard her and holds the primary legal guardianship over her. The mother, however, is not to be prevented from visiting her daughter so long as no harm results. If the father is unable to protect the girl, is negligent due to preoccupation, or is lax in religion, while the mother is fit to look after her, custody is transferred to the mother.
Shaykh al-Islam Ibn Taymiyyah said: “Imam Ahmad and his colleagues give precedence to the father provided that doing so causes her no harm. If it becomes evident that he is unable to preserve and protect her—neglecting her because of other concerns—while the mother duly safeguards and protects her, then the mother takes precedence in this situation. Whenever the child’s welfare is compromised with one parent, the other is unquestionably more entitled to custody.”
He further remarked: “If the father marries another wife and leaves the girl with that co-wife—who neither looks after her interests, harms her, nor fulfills her needs—while the girl’s mother tends to her welfare without causing harm, custody in this case belongs unequivocally to the mother.” And Allah knows best.