Narrated from Sayyida Aisha, Mother of the Believers (may Allah be pleased with her): Sayyida Barirah (may Allah be pleased with her) came to me and said, "I have made a contract with my owners for my freedom in exchange for nine uqiyah of silver, to be paid one uqiyah each year. Please help me." So Sayyida Aisha (may Allah be pleased with her) said, "If your owners agree, I will pay your amount (in one lump sum), but your relationship (wala’) of freedom will be for me." Barirah (may Allah be pleased with her) went and made the offer to her owners, but they did not agree, so Barirah (may Allah be pleased with her) returned while the Messenger of Allah ﷺ was also present with Aisha (may Allah be pleased with her). She said, "I made the offer to them, but they insist that the wala’ should be for them." The Messenger of Allah ﷺ heard this, and Aisha (may Allah be pleased with her) explained the details. He ﷺ said, "Buy her and stipulate the condition of wala’. The relationship of wala’ belongs to the one who sets free." Then he addressed the people and said: "Amma ba'd! What is wrong with people that they stipulate conditions which are not in the Book of Allah? Every condition that is not in accordance with the Book of Allah is invalid, even if there are a hundred such conditions. Allah’s decision is true, and Allah’s condition is the strongest. The wala’ will be for the one who sets free."
Hadith Referenceالسنن المأثورة / باب في أكل لحوم الخيل والبغال والحمير / 580
Hadith Takhrijصحیح بخاری، البیوع، باب اذا اشترط شروطا فی البیع لا تحل رقم 2168، صحیح مسلم، العتق باب انما الولاء لمن اعتق رقم: 1504۔