إِلَّا ٱلَّذِينَ عَـٰهَدتُّم مِّنَ ٱلْمُشْرِكِينَ ثُمَّ لَمْ يَنقُصُوكُمْ شَيْـًٔا وَلَمْ يُظَـٰهِرُوا۟ عَلَيْكُمْ أَحَدًا فَأَتِمُّوٓا۟ إِلَيْهِمْ عَهْدَهُمْ إِلَىٰ مُدَّتِهِمْ ۚ إِنَّ ٱللَّهَ يُحِبُّ ٱلْمُتَّقِينَ
Illal lazeena 'aahattum minal mushrikeena summa lam yanqusookum shai'anw-wa lam yuzaahiroo 'alaikum ahadan fa atimmooo ilaihim 'ahdahum ilaa muddatihim; innal laaha yuhibbul muttaqeen
Except for those among the idolaters with whom you made a treaty and who then did not fail you in anything nor backed anyone against you — fulfill your treaty with them to the end of its term. God loves those who are mindful of him.
Two conditions define the exception, and both concern conduct: the treaty was kept in full, and no support was given to an enemy. The line about God loving the mindful closes this verse and returns three verses later, bracketing the passage, so treaty-keeping is set under taqwā. How this exception and the protection granted in verse 6 stand in relation to verse 5 is among the oldest disputes in the commentaries, and it remains open.