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:17:73

And indeed, they were about to tempt you away from that which We revealed to you in order to ˹make˺ you invent about Us something else; and then they would have taken you as a friend.  

The following was revealed regarding the ˹tribe of˺ Thaqīf, for they had asked him ˹the Prophet˺ (s) to declare their valley inviolable and implored him ˹to grant them this request˺: And indeed (wa-in, ˹the particle in is˺ softened) they were about to, they nearly did, beguile you away from that which We revealed to you, so that you might invent against Us ˹something˺ other than that; and then, had you done that, they would have taken you as a friend.
القرآن:١٧:٧٣

وَإِنْ كَادُوا لَيَفْتِنُونَكَ عَنِ الَّذِي أَوْحَيْنَا إِلَيْكَ لِتَفْتَرِيَ عَلَيْنَا غَيْرَهُ ۖ وَإِذًا لَاتَّخَذُوكَ خَلِيلًا  

{وإن} مخففة {كادوا} قاربوا {ليفتنونك} ليستنزلون {عن الذي أوحينا إليك لتفتري علينا غيره وإذا} لو فعلت ذلك {لاتخذوك خليلاً}.