Abu Ja`far Ar-Razi said that Ar-Rabi` bin Anas said that Abu Al-`Aliyah commented on what Allah said:
﴿ وَقَـٰتِلُواْ فِى سَبِيلِ ٱللَّهِ ٱلَّذِينَ يُقَـٰتِلُونَكُمۡ ﴾
(And fight in the way of Allah those who fight you,)
Abu Al-`Aliyah said, "This was the first Ayah about fighting that was revealed in Al-Madinah. Ever since it was revealed, Allah's Messenger used to fight only those who fought him and avoid non-combatants. Later, Surat Bara'ah (chapter 9 in the Qur'an) was revealed.'' `Abdur-Rahman bin Zayd bin Aslam said similarly, then he said that this was later abrogated by the Ayah:
﴿ فَٱقۡتُلُواْ ٱلۡمُشۡرِكِينَ حَيۡثُ وَجَدتُّمُوهُمۡ ﴾
(then kill them wherever you find them) (9:5).
However, this statement is not plausible, because Allah's statement:
﴿ ٱلَّذِينَ يُقَـٰتِلُونَكُمۡ ﴾
(...those who fight you) applies only to fighting the enemies who are engaged in fighting Islam and its people. So the Ayah means, `Fight those who fight you', just as Allah said (in another Ayah):
﴿ وَقَـٰتِلُواْ ٱلۡمُشۡرِڪِينَ كَآفَّةً۬ ڪَمَا يُقَـٰتِلُونَكُمۡ ڪَآفَّةً۬ۚ ﴾
(...and fight against the Mushrikin collectively as they fight against you collectively.) (9:36)
This is why Allah said later in the Ayah:
﴿ وَٱقۡتُلُوهُمۡ حَيۡثُ ثَقِفۡتُمُوهُمۡ وَأَخۡرِجُوهُم مِّنۡ حَيۡثُ أَخۡرَجُوكُمۡۚ ﴾
(And kill them wherever you find them, and turn them out from where they have turned you out.) meaning, `Your energy should be spent on fighting them, just as their energy is spent on fighting you, and on expelling them from the areas from which they have expelled you, as a law of equality in punishment.'