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:217

They ask you about the sacred month - about fighting therein. Say, "Fighting therein is great ˹sin˺, but averting ˹people˺ from the way of Allah and disbelief in Him and ˹preventing access to˺ al-Masjid al-Haram and the expulsion of its people therefrom are greater ˹evil˺ in the sight of Allah. And fitnah is greater than killing." And they will continue to fight you until they turn you back from your religion if they are able. And whoever of you reverts from his religion ˹to disbelief˺ and dies while he is a disbeliever - for those, their deeds have become worthless in this world and the Hereafter, and those are the companions of the Fire, they will abide therein eternally.  

Thus the Prophet (s) sent forth the first of his raiding parties under the command of ‘Abd Allāh b. Jahsh. They fought against the idolaters and killed ˹‘Amr b. ‘Abd Allāh˺ Ibn al-Hadramī in ˹the sacred month of˺ Rajab, thinking that it was the last day of Jumādā II. The disbelievers reviled them for making fighting lawful in a sacred month, and so God revealed the following: They ask you about the sacred, the forbidden, month, and fighting in it (qitālin fīhi, ‘fighting in it’, is an inclusive substitution ˹for al-shahri l-harāmi, ‘the sacred month’˺). Say, to them: ‘Fighting (qitālun is the subject) in it is a grave thing (kabīr, ‘grave’, is the predicate), that is, heinous in terms of sin; but to bar (saddun is the subject), people, from God’s way, His religion, and disbelief in Him, in God, and, to bar from, the Sacred Mosque, that is, Mecca, and to expel its people, the Prophet (s) and the believers, from it — that is graver (the predicate of the ˹last˺ subject), ˹that is˺ more heinous in terms of sin than fighting in it, in God’s sight; and sedition, your idolatry, is graver than, your, slaying’, in it. They, the disbelievers, will not cease to fight against you, O believers, until, so that, they turn you from your religion, to unbelief, if they are able; and whoever of you turns from his religion, and dies disbelieving — their, good, works have failed, that is, they are invalid, in this world and the Hereafter. Thus they will not count for anything and will not result in any reward. The specification of death as a condition is because if that person were to return to Islam ˹again˺, his original deeds would not be invalidated, and he will be rewarded for them, and he would not have to repeat them, ˹deeds˺ such as ˹performing˺ the Pilgrimage: al-Shāfi‘ī is of this opinion. Those are the inhabitants of the Fire, abiding therein.
القرآن:٢:٢١٧

يَسْأَلُونَكَ عَنِ الشَّهْرِ الْحَرَامِ قِتَالٍ فِيهِ ۖ قُلْ قِتَالٌ فِيهِ كَبِيرٌ ۖ وَصَدٌّ عَنْ سَبِيلِ اللَّهِ وَكُفْرٌ بِهِ وَالْمَسْجِدِ الْحَرَامِ وَإِخْرَاجُ أَهْلِهِ مِنْهُ أَكْبَرُ عِنْدَ اللَّهِ ۚ وَالْفِتْنَةُ أَكْبَرُ مِنَ الْقَتْلِ ۗ وَلَا يَزَالُونَ يُقَاتِلُونَكُمْ حَتَّىٰ يَرُدُّوكُمْ عَنْ دِينِكُمْ إِنِ اسْتَطَاعُوا ۚ وَمَنْ يَرْتَدِدْ مِنْكُمْ عَنْ دِينِهِ فَيَمُتْ وَهُوَ كَافِرٌ فَأُولَٰئِكَ حَبِطَتْ أَعْمَالُهُمْ فِي الدُّنْيَا وَالْآخِرَةِ ۖ وَأُولَٰئِكَ أَصْحَابُ النَّارِ ۖ هُمْ فِيهَا خَالِدُونَ  

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