How can there be for the polytheists a treaty in the sight of Allāh and with His Messenger, except for those with whom you made a treaty at al-Masjid al-Ḥarām? So as long as they are upright toward you,1 be upright toward them. Indeed, Allāh loves the righteous [who fear Him].
It is not correct for those who associate partners with Allah to have a treaty and an assurance of protection from Allah and His Messenger, except for the treaty you made with those idolaters at the Sacred Mosque in the Treaty of Al-Ḥudaybiyyah. As long as they uphold the treaty with you and do not break it, then you should also not break it. Allah loves those of His servants who are mindful of Him by fulfilling His instructions and avoiding His prohibitions.