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:34:21

And he had over them no authority except ˹it was decreed˺ that We might make evident who believes in the Hereafter from who is thereof in doubt. And your Lord, over all things, is Guardian.  

And he did not have any warrant over them, any power to sway ˹them˺, from Us, but that We might know, by ˹this˺ knowledge being made manifest, him who believed in the Hereafter from him who was in doubt thereof, and so requite each of the two accordingly. And your Lord is Preserver, Watcher, of all things.
القرآن:٣٤:٢١

وَمَا كَانَ لَهُ عَلَيْهِمْ مِنْ سُلْطَانٍ إِلَّا لِنَعْلَمَ مَنْ يُؤْمِنُ بِالْآخِرَةِ مِمَّنْ هُوَ مِنْهَا فِي شَكٍّ ۗ وَرَبُّكَ عَلَىٰ كُلِّ شَيْءٍ حَفِيظٌ  

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