Page 550
lā yanhākumu llāhu ʿani lladhīna lam yuqātilūkum fī d-dīni wa-lam yukhrijūkum min diyārikum ʾan tabarrūhum wa-tuqsiṭū ʾilayhim ʾinna llāha yuḥibbu l-muqsiṭīna
Allah does not forbid you from dealing with kindness and justice with those [polytheists] who did not make war against you on account of religion and did not expel you from your homes. Indeed Allah loves the just.
— Ali Quli Qarai
Surah al-Mumtahana - Verses 8-9
The blessed Verses provide further exposition on forbidding befriending polytheists. The blessed Verse 8 is saying that God Almighty does not forbid you to do good to and deal justly with those who did not struggle against you owing to your conversion to the Islamic faith nor did they drive you out of your homeland, since God Almighty loves those who deal with equity. The blessed Verse 9 is saying that God Almighty solely forbids you to refrain from befriending those who fought against you on account of your faith and drove you out of your homeland or contributed to your being driven out. God Almighty strictly forbids you from establishing friendly ties with them and whoever befriends them is regarded as a wrong-doer disobeying Allah's Command.
Thus, non-Muslims fall into two groups. There were those who confronted Muslims by drawing their swords against them and driving them from their homeland and demonstrated their enmity against Islam and Muslims through their words and deeds. It is incumbent upon Muslims to sever all their ties with them and refrain from befriending them. The group is explicitly represented by Meccan polytheists, particularly their chiefs, some of whom perpetrated such misdeeds and some others rendered them support. There were also disbelievers who neither entertained enmity against Muslims nor did they fought them nor contributed to driving them out of their homeland.
There were still non-Muslims who had made treaties of non-intervention with Muslims and befriending them entailed no loss. It was also incumbent upon Muslims to keep their treaties with them and strive toward the administration of justice.