عن رافع بن سنان أنه أسلَمَ وأَبَتْ امرأتُه أن تُسْلِم، فأتت النبي صلى الله عليه وسلم ، فقالت: ابنتي وهي فَطِيمٌ أو شَبَهُهُ، وقال رافع: ابنتي، قال له النبي صلى الله عليه وسلم : «اقعد ناحية»، وقال لها: «اقعدي ناحية»، قال: «وأقعد الصَبِيَّةَ بينهما»، ثم قال «ادعواها»، فمَالت الصبية إلى أمها، فقال النبي صلى الله عليه وسلم : «اللهم اهدها»، فمالت الصبية إلى أَبيها، فأخذها.
This Hadīth talks about a mother and father who were disputing about the custody of their daughter in the presence of the Prophet (may Allah's peace and blessings be upon him). The father was a Muslim, but the mother was not. They were arguing about their daughter, so the Prophet (may Allah's peace and blessings be upon him) got the girl to choose between them. She initially chose her mother.
However, as the mother was a disbeliever, the Prophet (may Allah's peace and blessings be upon him) prayed that Allah would guide the girl to make the right choice. Allah, the Almighty, answered the Prophet's invocation, and the girl then chose her father. The benefit of the story is that it is not in accordance with divine guidance for a child to be under the care of a disbelieving parent.
Having custody means raising a child and protecting him from damage, and the best upbringing is to keep the child's religion intact and the best means of protection is to keep lack of belief away from him. If a child was raised by a disbelieving parent, he would be tempted by them to give up Islam and they would make him leave by teaching him the principles of disbelief and raising him on them.
This is the worst harm that can be done to a child, as having custody is meant to protect a child; it is not allowed to be carried out in a manner that involves the destruction of a child or their religion.
Download for free and never miss a prayer again