(10) باب مَا يَجُوزُ مِنْ شُرُوطِ الْمُكَاتَبِ إِذَا رَضِيَ بِالْبَيْعِ عَلَى أَنْ يُعْتَقَ
Narrated Aiman Al-Makki:
When I visited Aisha she said, "Buraira who had a written contract for her emancipation for a certain amount came to me and said, "O mother of the believers! Buy me and manumit me, as my masters will sell me." Aisha agreed to it. Buraira said, 'My masters will sell me on the condition that my Wala will go to them." Aisha said to her, 'Then I am not in need of you.' The Prophet (ﷺ) heard of that or was told about it and so he asked Aisha, 'What is the problem of Buraira?' He said, 'Buy her and manumit her, no matter what they stipulate.' Aisha added, 'I bought and manumitted her, though her masters had stipulated that her Wala would be for them.' The Prophet (ﷺ) said, The Wala is for the liberator, even if the other stipulated a hundred conditions."
Reference: Sahih al-Bukhari 2726
In-book reference: Book 54, Hadith 14
USC-MSA web (English) reference(deprecated numbering scheme): Vol. 3, Book 50, Hadith 886