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:26:29

˹Pharaoh˺ said, "If you take a god other than me, I will surely place you among those imprisoned."  

He, Pharaoh, said, to Moses: ‘If you choose any god other than me, I will surely make you a prisoner!’. His ˹Pharaoh’s˺ prison was very harsh, for a person would be shut up ˹in a dungeon˺ underground alone, where he could neither see nor hear anyone else.
القرآن:٢٦:٢٩

قَالَ لَئِنِ اتَّخَذْتَ إِلَٰهًا غَيْرِي لَأَجْعَلَنَّكَ مِنَ الْمَسْجُونِينَ  

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