Sahih Muslim Book 9, Hadith Number 3600.

Chapter: It is forbidden for a slave to take anyone as his ally except one who emancipates him.

Abu Huraira (Allah be pleased with him) reported Allah’s Apostle (may peace be upon him) as saying: He who took the freed slave as his ally without the consent of his previous master, there is upon him the curse of Allah and that of His angels and that of the whole mankind, and there will not be accepted from him his obligatory acts or supererogatory acts on the Day of Resurrection. This hadith is narrated through the same chain of transmitters, but with a slight change of words.