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:40:12

˹They will be told˺, "That is because, when Allah was called upon alone, you disbelieved; but if others were associated with Him, you believed. So the judgement is with Allah, the Most High, the Grand."  

That, namely, the chastisement which you find yourselves in, is because, during ˹the life of˺ this world, when God was invoked alone, you would disbelieve, in His Oneness; but if partners were ascribed to Him, you would believe, you would accept such idolatry. So the judgement, to chastise you, belongs to God, the Exalted, above His creation, the Great, the Tremendous.
القرآن:٤٠:١٢

ذَٰلِكُمْ بِأَنَّهُ إِذَا دُعِيَ اللَّهُ وَحْدَهُ كَفَرْتُمْ ۖ وَإِنْ يُشْرَكْ بِهِ تُؤْمِنُوا ۚ فَالْحُكْمُ لِلَّهِ الْعَلِيِّ الْكَبِيرِ  

{ذلكم} أي العذاب أنتم فيه {بأنه} أي بسبب أنه في الدنيا {إذا دعي الله وحده كفرتم} بتوحيده {وإن يُشرَك به} يجعل له شريك {تؤمنوا} تصدقوا بالإشراك {فالحكم} في تعذيبكم {لله العليِّ} على خلقه {الكبير} العظيم.