It is narrated from Sayyiduna Ibn Amr (may Allah be pleased with him) that the Noble Prophet (peace and blessings of Allah be upon him) gave this ruling: "A woman has more right to her child as long as she does not marry someone else."
Hadith Referenceمسند احمد / مسند المكثرين من الصحابة / 6893