Answer: Children who have not yet reached the age of discernment remain with their mother—unless she remarries, for in that case she forfeits custody.
If the boys reach seven years of age, they are given the choice; should they choose the parent who is better for their religion and sound upbringing, they will stay with that parent, whether it be the father or the mother.
In practice, the responsible authority refers the matter to the shar‘i judge, who considers the welfare of the children and places them with whomever will treat them kindly and raise them properly.
***
Obedience to parents in choosing a wife
Question: I am a young man who wishes to marry. I have proposed to a girl from outside our family and informed my father and mother of this, but they refused the marriage. I remain adamant about marrying her, yet my mother said, “If you marry this girl, I will never forgive you—neither in this world nor in the Hereafter—and we will never have any contact.” My brothers likewise refuse, and so does my father. I do not know why they have rejected my marrying her; nothing objectionable has appeared to me. I am firmly determined: will I be sinful if I marry her? Would that be considered undutiful and disobedient toward my parents? Advise me—should I marry her or should I leave her?
Answer: Since your parents and your brothers have unanimously agreed to prevent you from marrying this girl, you should not marry her. They know about her what you do not know, and they are among the most sincere and compassionate people toward you. Had they not known something about her that is unsuitable, they would not have stopped you from marrying her—especially your parents, whose affection and concern for their child are well known. Therefore, you should not marry this woman, for they have warned you.