Aal-'Imran - 3:152

وَلَقَدْ صَدَقَكُمُ اللّهُ وَعْدَهُ إِذْ تَحُسُّونَهُم بِإِذْنِهِ حَتَّى إِذَا فَشِلْتُمْ وَتَنَازَعْتُمْ فِي الأَمْرِ وَعَصَيْتُم مِّن بَعْدِ مَا أَرَاكُم مَّا تُحِبُّونَ مِنكُم مَّن يُرِيدُ الدُّنْيَا وَمِنكُم مَّن يُرِيدُ الآخِرَةَ ثُمَّ صَرَفَكُمْ عَنْهُمْ لِيَبْتَلِيَكُمْ وَلَقَدْ عَفَا عَنكُمْ وَاللّهُ ذُو فَضْلٍ عَلَى الْمُؤْمِنِينَ
[3:152]
And certainly Allah made good to you His promise when you slew them by His permission, until when you became weak-hearted and disputed about the affair and disobeyed after He had shown you that which you loved; of you were some who desired this world and of you were some who desired the hereafter; then He turned you away from them that He might try you; and He has certainly pardoned you, and Allah is Gracious to the believers.
Allah did indeed fulfil His promise to you when ye with His permission Were about to annihilate your enemy,-until ye flinched and fell to disputing about the order, and disobeyed it after He brought you in sight (of the booty) which ye covet. Among you are some that hanker after this world and some that desire the Hereafter. Then did He divert you from your foes in order to test you but He forgave you: For Allah is full of grace to those who believe.
Allah verily made good His promise unto you when ye routed them by His leave, until (the moment) when your courage failed you, and ye disagreed about the order and ye disobeyed, after He had shown you that for which ye long. Some of you desired the world, and some of you desired the Hereafter. Therefore He made you flee from them, that He might try you. Yet now He hath forgiven you. Allah is a Lord of Kindness to believers.