Sayyiduna Ibn Abbas (may Allah be pleased with them both) narrates that Allah Almighty said: "But if they turn away, then seize them and kill them wherever you find them, and take not from among them any ally or helper, except those who join a people between whom and you there is a treaty" [Surah al-Nisa: 89-90]. And this statement of Allah Almighty: "Allah does not forbid you from those who did not fight you because of religion and did not expel you from your homes" [Surah al-Mumtahanah: 8], that is, Allah Almighty does not forbid you from treating them with kindness and good conduct. Then these verses were abrogated, and Allah Almighty revealed these verses: "Freedom from obligation from Allah and His Messenger to those with whom you made a treaty among the polytheists" [Surah al-Tawbah: 1], up to His statement: "And when the sacred months have passed, then kill the polytheists wherever you find them" [Surah al-Tawbah: 5] - that is, Allah and His Messenger declare their disassociation from the polytheists with whom you made a covenant, up to: when the sacred months have passed, kill the polytheists wherever you find them. And likewise this statement of Allah Almighty was revealed: "And fight the polytheists all together as they fight you all together" [Surah al-Tawbah: 36]. And Allah Almighty said: "And if they incline to peace, then incline to it (you too, peace and blessings be upon him)" [Surah al-Anfal: 61]. This verse was abrogated by this statement of Allah Almighty: "Fight those who do not believe in Allah or in the Last Day, and do not consider unlawful what Allah and His Messenger have made unlawful" [Surah al-Tawbah: 29].
Hadith Referenceالسنن الكبرى للبيهقي / كتاب السير / 17744