Ibn Kathir mentioned in his tafsir that it is narrated from Ibn Abi Hatim from Sufyan Ibn Uyaynah from Ali (ra) said:
“RasulAllah (saw) was sent with four swords.
– A sword for the mushrikin (polytheists): “Freedom from (all) obligations (is declared) from Allah and His Messenger to those of the Mushrikin, with whom you made a treaty. So travel freely (O Mushrikin) for four months (as you will) throughout the land, but know that you cannot escape (from the Punishment of) Allah, and Allah will disgrace the disbelievers. And a declaration from Allah and His Messenger to mankind on the greatest day (the 10th of Dhul-Hijjah) that Allah is free from (all) obligations to the Mushrikin and so is His Messenger. So if you (Mushrikin) repent, it is better for you, but if you turn away, then know that you cannot escape (from the Punishment of) Allah. And give tidings (O Muhammad) of a painful torment to those who disbelieve. Except those of the Mushrikin with whom you have a treaty, and who have not subsequently failed you in aught, nor have supported anyone against you. So fulfill their treaty to them to the end of their term. Surely Allah loves al- Mattaqin. Then when the Sacred Months have passed, then kill the Mushrikin wherever you find them, and capture them and besiege them, and prepare for them each and every ambush. But if they repent and perform as-Salaat, and give Zakaat, then leave their way free. Verily, Allah is Oft-Forgiving, Most Merciful.” (at-Tawbah 9/1-5)
– A sword for the people of the book: “Fight against those who believe not in Allah, nor in the Last Day, nor forbid that which has been forbidden by Allah and His Messenger and those who acknowledge not the religion of truth (i.e., Islam) among the people of the Scripture (Jews and Christians), until they pay the Jizyah with willing submission, and feel themselves subdued.” (at-Tawbah 9/29)
– A sword for the transgressors: “But if one of them rebels against the other, then fight you (all) against the one that which rebels.” (al-Hujurat 49/9)
– A sword for the munafiqin (hypocrites): “O Prophet! Strive hard against the disbelievers and the hypocrites, and be severe against them, their abode will be Hell, and worst indeed is that destination.” (at-Tahrim 64/9)”
(Tafsir, Ibn Kathir)
Imam Ibn Rajab al-Hanbali (ra) said:
“And what is apparent is that in the Qur’an there are four swords:
– The sword against mushrikin (the polytheists) until they accept Islam or are restrained. Thereafter (is the time) either for generosity (i.e., free them without ransom), or ransom (according to what benefits Islam).
– And the sword against Munafiqin (the Hypocrites) and zanadiqah (the Heretics). And Allah has ordered with Jihaad against them and harshness with them in Surah Baraa’ah (at-Tawbah) and Surah at-Tahrim and the end of Surah al-Ahzab.
– And the sword against Ahlu’l-Kitaab (the People of the Book) until they pay the Jizya (Islamic tax).
– And the sword against Ahlu’l-bid’ah (the people of Transgression), as it is mentioned in Surah al-Hujurat.
And RasulAllah (saw) did not apply this sword during his life, and it was applied during the ruling (khilafah) of Ali (ra). And he used to say: “I am the one who has taught the people fighting the people of the Qiblah!”
And RasulAllah (saw) had other swords: From them: His (saw) sword against Murtadin (the people of apostasy) and they are those who he (saw) said about: “Whoever changes his religion then kill him!” And it was applied by Abu Bakr as-Siddiq (ra) during his rule upon those who apostated from the tribes of the Arabs.
And from is the sword against the Maariqin and they are the people of innovation such as the Khawarij.
And it has been affirmed as an order from him to fight them with the differing of the scholars in their disbelief. And Ali (ra) fought them during his rule with his statement: “They are not kuffar (disbelievers)!” And it was reported from Ali (ra) that RasulAllah (saw) ordered with the killing of the Maariqin and the disloyal ones and rebellious and Ali (ra) burned a group from the Heretics. So Ibn Abbas (ra) approved of their killing but denounced burning them with fire. So Ali (ra) said: “Beware Ibn Abbas, for looking for mistakes!” (al-Hikm al-Jadirah Bi’l-Idhaa’ah min Qawl an-Nabiyy: “I have been sent with the Sword until the Last Day!”