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:8:30

And ˹remember, O Muhammad˺, when those who disbelieved plotted against you to restrain you or kill you or evict you ˹from Makkah˺. But they plan, and Allah plans. And Allah is the best of planners.  

And, remember, O Muhammad (s), when the disbelievers — who had gathered to discuss your affair at the council assembly — were plotting against you, to confine you, to chain you up and imprison you, or slay you — all of them ˹acting as˺ assassins of one man — or to expel you, from Mecca, and they were plotting, against you, and God was plotting, against them, by devising a way ˹out˺ for you, when He revealed to you what they had devised and commanded you to leave ˹Mecca˺; and God is the best of those who plot, the most knowledgeable among them about it.
القرآن:٨:٣٠

وَإِذْ يَمْكُرُ بِكَ الَّذِينَ كَفَرُوا لِيُثْبِتُوكَ أَوْ يَقْتُلُوكَ أَوْ يُخْرِجُوكَ ۚ وَيَمْكُرُونَ وَيَمْكُرُ اللَّهُ ۖ وَاللَّهُ خَيْرُ الْمَاكِرِينَ  

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