The Prophet ﷺ ruled that a mother has the greater right to her child as long as she has not remarried.
حدثنا عبد الرزاق سمعت المثنى بن الصباح يقول أخبرني عمرو بن شعيب عن أبيه
أن النبي ﷺ قضى أن المرأة أحق بولدها ما لم تزوج
No references are available.
Its chain of transmission is hasan, then it becomes sahih li-ghayrihi, as will come, Allah willing.Muthanna bin Sabbah Yamani Abnawi Makki, a righteous shaykh, was deemed reliable by Ibn Main, according to what Abbas Duri reported from him. Ibn Abu Hatim asked his father and Abu Zura about him, and they both said he was lenient in hadith, weak in transmission. Ibn Saad, Nasai, and others declared him daif, and he had become confused in his memory toward the end of his life. Abdul-Razzaq said, "I came to know him as an old man, walking between two people, going around the whole night."Bukhari mentioned him in his Kabir, 1/4/419, and said, "He transmits from Ataa and Amr bin Shuayb." Yahya Qattan said, "Muthanna was not abandoned because of Amr bin Shuayb, but rather there was confusion in his memory from him." Something similar is in the Saghir, p. 173, and the Duafa, p. 34, both by Bukhari, and this is perhaps the fairest thing said about him.Muthanna, with the mim vocalized with damma, the tha with fatha and doubled, followed by an alif maqsura. And Sabbah, with a plain sad, a doubled ba, and ending with a plain ha.The meaning of this hadith has already appeared at length as number 6707, through the narration of Ibn Jurayj from Amr bin Shuayb. For this reason we have concluded that it is sahih li-ghayrihi, since it has become clear that Muthanna was not alone in narrating it.