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:46:28

Then why did those they took besides Allah as deities by which to approach ˹Him˺ not aid them? But they had strayed from them. And that was their falsehood and what they were inventing.  

So why did they not help them, by averting from them the chastisement, those whom they had chosen besides God, that is to say, other than Him, as ˹a means of˺ nearness, through whom they may secure nearness to God, to be gods?, alongside Him, and these are the idols (the first object of ittakhadhū, ‘they had chosen’, is the omitted pronoun referred to by the relative clause ˹alladhīna, ‘those who …’˺, and it is hum, ‘they’; qurbānan, ‘nearness’, is the second ˹object˺, with ālihatan, ‘gods’, as its substitution). Nay, but they forsook them, when the chastisement came down ˹on them˺, and that, that is to say, ˹that˺ choosing of theirs of idols as gods as a means of nearness ˹to God˺, was their lie and what they used to invent — the lies they used to speak (mā, ‘what’, either relates to the verbal action ˹‘their lying’˺, or it indicates a relative clause with the referential pronoun omitted, this being fīhi, ‘about’).
القرآن:٤٦:٢٨

فَلَوْلَا نَصَرَهُمُ الَّذِينَ اتَّخَذُوا مِنْ دُونِ اللَّهِ قُرْبَانًا آلِهَةً ۖ بَلْ ضَلُّوا عَنْهُمْ ۚ وَذَٰلِكَ إِفْكُهُمْ وَمَا كَانُوا يَفْتَرُونَ  

{فلولا} هلا {نصرهم} بدفع العذاب عنهم {الذين اتخذوا من دون الله} أي غيره {قربانا} متقربا بهم إلى الله {آلهة} معه وهم الأصنام ومفعول اتخذ الأول ضمير محذوف يعود على الموصول أي هم، وقربانا الثاني وآلهة بدل منه {بل ضلوا} غابوا {عنهم} عند نزول العذاب {وذلك} أي اتخاذهم الأصنام آلهة قربانا {إفكهم} كذبهم {وما كانوا يفترون} يكذبون، وما مصدرية أو موصولة والعائد محذوف، أي فيه.