The Holy verse says:
" And fight them until there is no fitnah and [until] the religion, all of it, is for Allah. And if they cease – then indeed, Allah is Seeing of what they do.." (8:39)
First of all let's put the verse in its right context by mentioning the verses before and the verse after it (from 8:30 to 8:40). The Holy Quarn says:
"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 when Our verses are recited to them, they say, "We have heard. If we willed, we could say [something] like this. This is not but legends of the former peoples."
And [remember] when they said, "O Allah, if this should be the truth from You, then rain down upon us stones from the sky or bring us a painful punishment."
But Allah would not punish them while you, [O Muhammad], are among them, and Allah would not punish them while they seek forgiveness.
But why should Allah not punish them while they obstruct [people] from al-Masjid al-Haram and they were not [fit to be] its guardians? Its [true] guardians are not but the righteous, but most of them do not know.
And their prayer at the House was not except whistling and handclapping. So taste the punishment for what you disbelieved.
Indeed, those who disbelieve spend their wealth to avert [people] from the way of Allah. So they will spend it; then it will be for them a [source of] regret; then they will be overcome. And those who have disbelieved – unto Hell they will be gathered.
[This is] so that Allah may distinguish the wicked from the good and place the wicked some of them upon others and heap them all together and put them into Hell. It is those who are the losers.
Say to those who have disbelieved [that] if they cease, what has previously occurred will be forgiven for them. But if they return [to hostility] – then the precedent of the former [rebellious] peoples has already taken place.
And fight them until there is no fitnah and [until] the religion, all of it, is for Allah. And if they cease – then indeed, Allah is Seeing of what they do.
But if they turn away – then know that Allah is your protector. Excellent is the protector, and Excellent is the helper." (8:30-40)
Don't forget here that God said "FIGHT" NOT "KILL", because fight is a mutual act meaning both sides are fighting not one is just attacking and the other is helplessly watching. But WHY did God order Muslims to fight against the disbelievers. The reasons were stated in earlier verses.
Why fight the disbelievers?
What is being discussed in the verses above is mischief of “wicked” or “bad” disbelievers (Verse 8:37) who are being asked to desist from their wickedness, for if they do so (it doesn’t say that they have to convert), their past wickedness would be forgiven.
Verse 8:40 clarifies that if the mischief-makers turn away, Muslims shouldn’t worry about them (in other words, Muslims should leave them alone) for God is their Protector and Helper. Verse 8:41 is simply about the distribution of booty gained from these wars.
Actually, the discussion of these mischievous disbelievers and their deeds starts with verse 8:30, where it is said:
"And when those who disbelieved devised plans against you that they might confine you or slay you or drive you away; and they devised plans and Allah too had arranged a plan; and Allah is the best of planners. " (8.30). That was the first indictment.
The second indictment comes in verse 8:34 where it is said:
"And what (excuse) have they that Allah should not chastise them while they hinder (men) from the Sacred Mosque and they are not (fit to be) guardians of it; its guardians are only those who guard (against evil), but most of them do not know." (8:34)
The third indictment is given in Verse (8:36)
"Surely those who disbelieve spend their wealth to hinder (people) from the way of Allah; so they shall spend it, then it shall be to them an intense regret, then they shall be overcome; and those who disbelieve shall be driven together to hell." (8:36)
And because of these three indictments, God calls their acts “fitnah”. But what is "Fitnah"?
The meaning of Fitnah
The meaning of fitnah is sometimes misinterpreted for prosecution but let's first try to understand it's literal meaning in Arabic language.
“Al-Azhari said: “The Arabic word fitnah includes meanings of testing and trial. The root is taken from the phrase fatantu al-fiddah wa’l-dhahab (I assayed (tested the quality of) the silver and gold), meaning I melted the metals to separate the bad from the good.
“Ibn Faaris said: “Fa-ta-na is a sound root which indicates testing or trial.” (Maqaayees al-Lughah, 4/472). This is the basic meaning of the word fitnah in Arabic. so Fitna (from the verb fatana, for infatuation, charm, enticement, temptation, turning away) refers to temptation, fascinating, things that turn Muslims away from their religion or an act of sedition and a cause for dissension.
So why were the deeds of the disbelievers a temptation the derives Muslims away from their faith?
Simply because leaving the disbelievers attack Muslims and steal their money and even planning to kill the Noble Prophet, peace and blessings be upon him, will create a general feeling among Muslims of being weak and humiliated as they do not retaliate for themselves from these acts of severe aggression at the same time they see their transgressor as a strong winner. This will surely tempt them to turn away from the religion which does not allow them to fight back to regain their pride and stop their transgressor from attacking them.
So what if the disbelievers stopped?
If the disbelievers ceased their aggression then Muslims should stop attacking them, but these disbelievers should be very cautious because "Allah is Seeing of what they do."
The same part of the verse "Allah is Seeing of what they do." can also be interpreted that God is addressing the Muslims who fought against the disbelievers till they stopped their aggressiveness that He has seen and knows very well the effort they did and will reward them for it.
So what if the disbelievers do not stopped?
God is addressing the Muslims in the following verse telling them never to worry or be discouraged if the disbelievers turn away and if they do not stop their aggression because He Himself is their (the Muslims') protector and helper.
From the above discussion we conclude the following:
1- The disbelievers conspired against Muslims and they started the transgression against them threw three heinous deeds which are:
2- Muslims were ordered to fight to regain their pride and force their transgressor to think twice before attacking them. This order was given to them to safeguard their faith because if they feel that they are weak and humiliated, this frustration may tempt them to leave their faith.
So where is the aggressiveness in the verse, since when is defending yourself against transgression a crime? The general rule in Islam is clearly stated in the verse Al-Mumtahina. In it God says:
"Allah forbiddeth you not those who warred not against you on account of religion and drove you not out from your homes, that ye should show them kindness and deal justly with them. Lo! Allah loveth the just dealers. Allah forbiddeth you only those who warred against you on account of religion and have driven you out from your homes and helped to drive you out, that ye make friends of them. Whosoever maketh friends of them - (All) such are wrong-doers." (60:8-9)
In the above verses of the Holy verse al Mumtahanah, the believers are advised to show kindness and do justice to the unbelievers who are not hostile to them. Islam avoids killing and destruction, but when public peace and safety is at stake, prompt and severe action is taken to bring order and eliminate lawlessness. Islam has no room for willful aggressors and cunning mischief-makers.”
In fact Islam advocates universal peace and harmony in the human society and teaches us to tolerate and accommodate other creeds so far as their followers do not hatch plots and generate ill-will to destroy the Muslims and ascribe falsehood to Allah and His religion.
Sources: Controversial Islam Exploring Controversies About Islam