Chapter (Surah) 9 verse (Ayat) 5 is often referred to by anti-Islamists and others as the “verse of the sword”. A label given as it is claimed the verse sanctions warfare on non-Muslims. When the verse is put in context this claim falls apart.
1-14 Sahih International –
9:1 [This is a declaration of] disassociation, from Allah and His Messenger, to those with whom you had made a treaty among the polytheists.
9:2 So travel freely, [O disbelievers], throughout the land [during] four months but know that you cannot cause failure to Allah and that Allah will disgrace the disbelievers.
9:3 And [it is] an announcement from Allah and His Messenger to the people on the day of the greater pilgrimage that Allah is disassociated from the disbelievers, and [so is] His Messenger. So if you repent, that is best for you; but if you turn away – then know that you will not cause failure to Allah . And give tidings to those who disbelieve of a painful punishment.
9:4 Excepted are those with whom you made a treaty among the polytheists and then they have not been deficient toward you in anything or supported anyone against you; so complete for them their treaty until their term [has ended]. Indeed, Allah loves the righteous [who fear Him].
9:5 And when the sacred months have passed, then kill the polytheists wherever you find them and capture them and besiege them and sit in wait for them at every place of ambush. But if they should repent, establish prayer, and give zakah, let them [go] on their way. Indeed, Allah is Forgiving and Merciful.
9:6 And if any one of the polytheists seeks your protection, then grant him protection so that he may hear the words of Allah . Then deliver him to his place of safety. That is because they are a people who do not know.
9:7 How can there be for the polytheists a treaty in the sight of Allah and with His Messenger, except for those with whom you made a treaty at al-Masjid al-Haram? So as long as they are upright toward you, be upright toward them. Indeed, Allah loves the righteous [who fear Him].
9:8 How [can there be a treaty] while, if they gain dominance over you, they do not observe concerning you any pact of kinship or covenant of protection? They satisfy you with their mouths, but their hearts refuse [compliance], and most of them are defiantly disobedient.
9:9 They have exchanged the signs of Allah for a small price and averted [people] from His way. Indeed, it was evil that they were doing.
9:10 They do not observe toward a believer any pact of kinship or covenant of protection. And it is they who are the transgressors.
9:11 But if they repent, establish prayer, and give zakah, then they are your brothers in religion; and We detail the verses for a people who know.
9:12 And if they break their oaths after their treaty and defame your religion, then fight the leaders of disbelief, for indeed, there are no oaths [sacred] to them; [fight them that] they might cease.
9:13 Would you not fight a people who broke their oaths and determined to expel the Messenger, and they had begun [the attack upon] you the first time? Do you fear them? But Allah has more right that you should fear Him, if you are [truly] believers.
9:14 Fight them; Allah will punish them by your hands and will disgrace them and give you victory over them and satisfy the breasts of a believing people.
As can be seen from the context provided in the above quote – 9:5 is in reference to a specific situation when war was initiated by evil idolatrous pagans through the breaking of a treaty.
This compelled Muslims to win the war using best tactics. Which Allah (SWT) would allow to occur since the enemy was doing evil initiating the war and by being idolatrous pagans.