Nafi' narrates from Sayyiduna Ibn Umar (may Allah be pleased with them both) that he freed a child born of fornication and said: "Allah and His Messenger (peace and blessings be upon him) have ordered us to show kindness to evil people." Allah Almighty says: "Then either (show) favour afterwards or (take) ransom." [Surah Muhammad: 4] It is narrated from Sayyiduna Umar (may Allah be pleased with him) that he disliked it.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الأيمان / 20004