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:2:256

There shall be no compulsion in ˹acceptance of˺ the religion. The right course has become clear from the wrong. So whoever disbelieves in Taghut and believes in Allah has grasped the most trustworthy handhold with no break in it. And Allah is Hearing and Knowing.  

There is no compulsion in, entering into, religion. Rectitude has become clear from error, that is say, through clear proofs it has become manifest that faith is rectitude and disbelief is error: this was revealed concerning the Ansār ˹of Medina˺ who tried to compel their sons to enter into Islam; so whoever disbelieves in the false deity, namely, Satan or idols (tāghūt, ‘false deity’, is used in a singular and plural sense), and believes in God, has laid hold of the most firm handle, the tight knot, unbreaking, that cannot be severed; God is Hearing, of what is said, Knowing, of what is done.
القرآن:٢:٢٥٦

لَا إِكْرَاهَ فِي الدِّينِ ۖ قَدْ تَبَيَّنَ الرُّشْدُ مِنَ الْغَيِّ ۚ فَمَنْ يَكْفُرْ بِالطَّاغُوتِ وَيُؤْمِنْ بِاللَّهِ فَقَدِ اسْتَمْسَكَ بِالْعُرْوَةِ الْوُثْقَىٰ لَا انْفِصَامَ لَهَا ۗ وَاللَّهُ سَمِيعٌ عَلِيمٌ  

{لا إكراه في الدين} على الدخول فيه {قد تبين الرشد من الغي} أي ظهر بالآيات البينات أن الايمان رشد والكفر غي نزلت فيمن كان له من الأنصار اولاد أراد أن يكرههم علي الإسلام {فمن يكفر بالطاغوت} الشيطان أو الأصنام وهو يطلق على المفرد والجمع {ويؤمن بالله فقد استمسك} تمسك {بالعروة الوثقى} بالعقد المحكم {لا انفصام} انقطاع {لها والله سميع} لما يقال {عليم} بما يفعل.