Distress from Satan
Remember when you fled without looking back, while the Messenger called to you from behind? Allah repaid you with distress upon distress so that you would not grieve over what you lost or what befell you.
3:153When ye climbed (the hill) and paid no heed to anyone, while the messenger, in your rear, was calling you (to fight). Therefor He rewarded you grief for (his) grief, that (He might teach) you not to sorrow either for that which ye missed or for that which befell you. Allah is Informed of what ye do.
Then, after hardship, He sent down tranquillity upon you, a drowsiness that overtook some of you, while others were anxious, thinking wrongly about Allah, like the thoughts of ignorance. They asked, ‘Do we have any say in the matter?’ Say, ‘All matters belong to Allah.’ They conceal within themselves what they do not reveal to you, saying, ‘If we had any say, we would not have been killed here.’ Say, ‘Even if you had stayed in your homes, those destined to die would have gone to their places of death. Allah tests what is within you and purifies what is in your hearts.
3:154Then, after grief, He sent down security for you. As slumber did it overcome a party of you, while (the other) party, who were anxious on their own account, thought wrongly of Allah, the thought of ignorance. They said: Have we any part in the cause? Say (O Muhammad): The cause belongeth wholly to Allah. They hide within themselves (a thought) which they reveal not unto thee, saying: Had we had any part in the cause we should not have been slain here. Say: Even though ye had been in your houses, those appointed to be slain would have gone forth to the places where they were to lie. (All this hath been) in order that Allah might try what is in your breasts and prove what is in your hearts. Allah is Aware of what is hidden in the breasts (of men).
8:11When He made the slumber fall upon you as a reassurance from him and sent down water from the sky upon you, that thereby He might purify you, and remove from you the fear of Satan, and make strong your hearts and firm (your) feet thereby.
Indeed, those who turned away on the day the two armies met were made to slip by Satan due to their past deeds. But Allah has forgiven them.
3:155Lo! those of you who turned back on the day when the two hosts met, Satan alone it was who caused them to backslide, because of some of that which they have earned. Now Allah hath forgiven them. Lo! Allah is Forgiving, Clement.
Do not be like those who left their homes arrogantly, showing off to people and turning others away from Allah’s path.
8:47Be not as those who came forth from their dwellings boastfully and to be seen of men, and debar (men) from the way of Allah, while Allah is surrounding all they do.
And when Satan made their deeds seem fair to them, saying, “No one can defeat you today, and I am at your side.” But when the two forces met, he turned and fled, saying, “I have nothing to do with you! I see what you do not see, I fear Allah.”
8:48And when Satan made their deeds seem fair to them and said: No-one of mankind can conquer you this day, for I am your protector. But when the armies came in sight of one another, he took flight, saying: Lo! I am guiltless of you. Lo! I see that which ye see not. Lo! I fear Allah. And Allah is severe in punishment.