وَإِن يُرِيدُوا۟ خِيَانَتَكَ فَقَدْ خَانُوا۟ ٱللَّهَ مِن قَبْلُ فَأَمْكَنَ مِنْهُمْ ۗ وَٱللَّهُ عَلِيمٌ حَكِيمٌ
Commentary:
The treacherous dealing mentioned here is that disbelievers should do evil in return for the kindness shown to them. As was the custom in Arabia, pre-Islamic Arabs used to slay their powerful enemies, whenever they fell into their hands. The verse, therefore, signifies that if the enemies of Islam proved treacherous, God would give Muslims power over them again; so it is not necessary for Muslims to put their prisoners to death as pre-Islamic Arabs used to do.
God knew that the time was soon coming when the disbelievers would embrace Islam, hence the injunction to spare their lives and to treat them with kindness, for was not God "All-Knowing, Wise"?