3:122
إِذْ هَمَّت طَّآئِفَتَانِ مِن كُمْ أَن تَفْشَلَ ا وَ ٱللَّهُ وَلِيُّ هُمَا وَ عَلَى ٱللَّهِ فَ لْ يَتَوَكَّلِ ٱلْ مُؤْمِنُونَ
When two parties among you were about to lose courage, but Allah was their ally; and upon Allah the believers should rely.
3:152
وَ لَ قَدْ صَدَقَ كُمُ ٱللَّهُ وَعْدَ هُۥٓ إِذْ تَحُسُّ ونَ هُم بِ إِذْنِ هِۦ حَتَّىٰٓ إِذَا فَشِلْ تُمْ وَ تَنَٰزَعْ تُمْ فِى ٱلْ أَمْرِ وَ عَصَيْ تُم مِّنۢ بَعْدِ مَآ أَرَىٰ كُم مَّا تُحِبُّ ونَ مِن كُم مَّن يُرِيدُ ٱل دُّنْيَا وَ مِن كُم مَّن يُرِيدُ ٱلْ ءَاخِرَةَ ثُمَّ صَرَفَ كُمْ عَنْ هُمْ لِ يَبْتَلِيَ كُمْ وَ لَ قَدْ عَفَا عَن كُمْ وَ ٱللَّهُ ذُو فَضْلٍ عَلَى ٱلْ مُؤْمِنِينَ
And Allah had certainly fulfilled His promise to you when you were killing the enemy by His permission until [the time] when you lost courage and fell to disputing about the order [given by the Prophet] and disobeyed after He had shown you that which you love. Among you are some who desire this world, and among you are some who desire the Hereafter. Then he turned you back from them [defeated] that He might test you. And He has already forgiven you, and Allah is the possessor of bounty for the believers.
8:43
إِذْ يُرِي كَ هُمُ ٱللَّهُ فِى مَنَامِ كَ قَلِيلًا وَ لَوْ أَرَىٰكَ هُمْ كَثِيرًا لَّ فَشِلْ تُمْ وَ لَ تَنَٰزَعْ تُمْ فِى ٱلْ أَمْرِ وَ لَٰكِنَّ ٱللَّهَ سَلَّمَ إِنَّ هُۥ عَلِيمٌۢ بِ ذَاتِ ٱل صُّدُورِ
[Remember, O Muhammad], when Allah showed them to you in your dream as few; and if He had shown them to you as many, you [believers] would have lost courage and would have disputed in the matter [of whether to fight], but Allah saved [you from that]. Indeed, He is Knowing of that within the breasts.
8:46
وَ أَطِيعُ وا۟ ٱللَّهَ وَ رَسُولَ هُۥ وَ لَا تَنَٰزَعُ وا۟ فَ تَفْشَلُ وا۟ وَ تَذْهَبَ رِيحُ كُمْ وَ ٱصْبِرُ وٓا۟ إِنَّ ٱللَّهَ مَعَ ٱل صَّٰبِرِينَ
And obey Allah and His Messenger, and do not dispute and [thus] lose courage and [then] your strength would depart; and be patient. Indeed, Allah is with the patient.