Aal-i-Imraan • BN-TAFSEER-IBN-E-KASEER
﴿ وَلَقَدْ صَدَقَكُمُ ٱللَّهُ وَعْدَهُۥٓ إِذْ تَحُسُّونَهُم بِإِذْنِهِۦ ۖ حَتَّىٰٓ إِذَا فَشِلْتُمْ وَتَنَٰزَعْتُمْ فِى ٱلْأَمْرِ وَعَصَيْتُم مِّنۢ بَعْدِ مَآ أَرَىٰكُم مَّا تُحِبُّونَ ۚ مِنكُم مَّن يُرِيدُ ٱلدُّنْيَا وَمِنكُم مَّن يُرِيدُ ٱلْءَاخِرَةَ ۚ ثُمَّ صَرَفَكُمْ عَنْهُمْ لِيَبْتَلِيَكُمْ ۖ وَلَقَدْ عَفَا عَنكُمْ ۗ وَٱللَّهُ ذُو فَضْلٍ عَلَى ٱلْمُؤْمِنِينَ ﴾
“AND, INDEED, God made good His promise unto you when, by His leave, you were about to destroy your foes - until the moment when you lost heart and acted contrary to the [Prophet's] command, and disobeyed after He had brought you within view of that [victory] for which you were longing. There were among you such as cared for this world [alone], just as there were among you such as cared for the life to come: whereupon, in order that He might put you to a test, He prevented you from defeating your foes. But now He has effaced your sin: for God is limitless in His bounty unto the believers.”
Please check ayah 3:153 for complete tafsir.