وَلَقَدْ صَدَقَكُمُ اللّهُ وَعْدَهُ إِذْ تَحُسُّونَهُم بِإِذْنِهِ حَتَّى إِذَا فَشِلْتُمْ وَتَنَازَعْتُمْ فِي الأَمْرِ وَعَصَيْتُم مِّن بَعْدِ مَا أَرَاكُم مَّا تُحِبُّونَ مِنكُم مَّن يُرِيدُ الدُّنْيَا وَمِنكُم مَّن يُرِيدُ الآخِرَةَ ثُمَّ صَرَفَكُمْ عَنْهُمْ لِيَبْتَلِيَكُمْ وَلَقَدْ عَفَا عَنكُمْ وَاللّهُ ذُو فَضْلٍ عَلَى الْمُؤْمِنِينَ
﴿١٥٢﴾
سورة آل عمران
(3/152) And Allah did indeed fulfill His Promise to you when you were killing them with His Permission; after He showed you which you love (the victory) you became weak-hearted and fell to disputing about the order and you rebelled; of you were some who desired this world (ran for the booty) and of you were some who desired the Hereafter (they remained in their places until they became martyrs); then He turned you away from them that He might try you (you turned back being defeated) and (in spite of this) He has certainly pardoned you and Allah is Most Virtuous to the believers.
Surah Al Imran