Three men were brought before Ali while he was in Yemen. They had all had intercourse with the same woman during a single period of purity. He asked two of them, "Do you acknowledge this child as belonging to this man?"They replied, "No."He kept asking them in pairs, and each time he asked two of them, they would say, "No."So he cast lots between them and assigned the child to the one whose lot was drawn, and he ordered him to pay two-thirds of the blood-money to the other two. This was mentioned to the Prophet ﷺ, and he laughed until his back teeth showed.
حدثنا خشيش بن أصرم حدثنا عبد الرزاق أخبرنا الثوري عن صالح الهمداني عن الشعبي عن عبد خير
أتي علي رضي الله عنه بثلاثة وهو باليمن وقعوا على امرأة في طهر واحد فسأل اثنين أتقران لهذا بالولد قالا لا حتى سألهم جميعا فجعل كلما سأل اثنين قالا لا فأقرع بينهم فألحق الولد بالذي صارت عليه القرعة وجعل عليه ثلثي الدية قال فذكر ذلك للنبي ﷺ فضحك حتى بدت نواجذه
[Hasan]. Nasai reported it in the Book of Divorce, Chapter on Drawing Lots for a Child When Disputed Over, no. 3518, from Khushaysh bin Asram, with the same chain. Ibn Majah also narrated it, no. 2348, through the hadith of Abdul-Razzaq. The hadith has many chains, found with Humaydi, no. 786, and others.