Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:6:137

And likewise, to many of the polytheists their partners have made ˹to seem˺ pleasing the killing of their children in order to bring about their destruction and to cover them with confusion in their religion. And if Allah had willed, they would not have done so. So leave them and that which they invent.  

And thus, in the same way that what is mentioned was adorned for them, those associates of theirs, from among the jinn, have adorned for many of the idolaters the slaying of their children, by burying them alive (shurakā’uhum, ‘those associates of theirs’, is read in the nominative as the subject of the verb zayyana, ‘adorned’; an alternative reading has the passive ˹zuyyina, ‘it has been adorned’˺, with qatlu, ‘the slaying’, in the nominative ˹as the subject of this passive verb˺, awlādahum, ‘their children’, in the accusative on account of it ˹being the direct object of qatlu, ‘the slaying’˺, and shurakā’ihim in the genitive as an annexation to qatlu, so that the object in this case intervenes between the two elements of the annexation ˹qatlu awlādahum shurakā’ihim, ‘their associates killing the children’˺ — this is acceptable ˹syntactically˺ — and the annexation of qatlu to shurakā’ihim ˹in this latter reading˺ is on account of them ˹the associates˺ commanding ˹the idolaters to do˺ this), that they may destroy them and to confuse, to make obscure, their religion for them. Had God willed, they would not have done so; so leave them and that which they fabricate.
القرآن:٦:١٣٧

وَكَذَٰلِكَ زَيَّنَ لِكَثِيرٍ مِنَ الْمُشْرِكِينَ قَتْلَ أَوْلَادِهِمْ شُرَكَاؤُهُمْ لِيُرْدُوهُمْ وَلِيَلْبِسُوا عَلَيْهِمْ دِينَهُمْ ۖ وَلَوْ شَاءَ اللَّهُ مَا فَعَلُوهُ ۖ فَذَرْهُمْ وَمَا يَفْتَرُونَ  

{وكذلك} كما زين لهم ما ذكر {زَيَّنَ لكثير من المشركين قتل أولادهم} بالوأد {شركاؤُهم} من الجن بالرفع فاعل زين وفي قراءة ببنائه للمفعول ورفع قتل ونصب الأولاد به وجر شركائهم بإضافته وفيه الفصل بين المضاف والمضاف إليه بالمفعول - ولا يضر - وإضافة القتل إلى الشركاء لأمرهم به {ليردوهم} يهلكوهم {وليلبسوا} يخلطوا {عليهم دينهم ولو شاء الله ما فعلوه فذرهم وما يفترون}.