Sahih al-Bukhari Book 49, Hadith 14
When Abu Huraira accompanied by his slave set out intending to embrace Islam they lost each other
on the way. The slave then came while Abu Huraira was sitting with the Prophet. The Prophet (ﷺ) said,
"O Abu Huraira! Your slave has come back." Abu Huraira said, "Indeed, I would like you to witness
that I have manumitted him." That happened at the time when Abu Huraira recited (the following
poetic verse):-- 'What a long tedious tiresome night! Nevertheless, it has delivered us From the land of
Kufr (disbelief).
The Prophet (ﷺ) said, "The (reward of) deeds depend on intentions, and every person will get the reward according to what he intends. So, whoever migrated for Allah and His Apostle, then his migration will be for Allah and His Apostle, and whoever migrated for worldly benefits or for marrying a woman, then his migration will be for what he migrated for." (See Hadith No. 1, Vol. 1)
On my way to the Prophet (ﷺ) I was reciting:-- 'What a long tedious tiresome night! Nevertheless, it has saved us From the land of Kufr (disbelief).' I had a slave who ran away from me on the way. When I went to the Prophet (ﷺ) and gave the pledge of allegiance for embracing Islam, the slave showed up while I was still with the Prophet (ﷺ) who remarked, "O Abu Huraira! Here is your slave!" I said, "I manumit him for Allah's Sake," and so I freed him.