Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
bayhaqi:21528Yazīd > Zakariyyā b. Abū Zāʾidah > al-Shaʿbī > Suʾil

[Machine] About a man, he has sons from a free woman, and the servant has a free father. so it was asked, who has guardianship over his child? he said, for the guardians of the grandfather.  

البيهقي:٢١٥٢٨وَبِإِسْنَادِهِ أنبأ يَزِيدُ أنبأ زَكَرِيَّا بْنُ أَبِي زَائِدَةَ عَنِ الشَّعْبِيِّ أَنَّهُ سُئِلَ

عَنْ مَمْلُوكٍ لَهُ بَنُونَ مِنْ حُرَّةٍ وَلِلْعَبْدِ أَبٌ حُرٌّ فَقِيلَ لِمَنْ وَلَاءُ وَلَدِهِ؟ فَقَالَ لِمَوَالِي الْجَدِّ  


See similar narrations below:

Collected by Dārimī
darimi:3211Abū Nuʿaym > Zakariyyā

[Machine] About Amr, who was a slave, he died while having a free father and children from a free woman. To whom does the custody of his child belong? He said, "To the allies of the grandfather."  

الدارمي:٣٢١١حَدَّثَنَا أَبُو نُعَيْمٍ حَدَّثَنَا زَكَرِيَّا

عَنْ عَامِرٍ فِي مَمْلُوكٍ تُوُفِّيَ وَلَهُ أَبٌ حُرٌّ وَلَهُ بَنُونَ مِنَ امْرَأَةٍ حُرَّةٍ لِمَنْ وَلَاءُ وَلَدِهِ؟ قَالَ «لِمَوَالِي الْجَدِّ»