Aal-'Imran - 3:153

إِذْ تُصْعِدُونَ وَلاَ تَلْوُونَ عَلَى أحَدٍ وَالرَّسُولُ يَدْعُوكُمْ فِي أُخْرَاكُمْ فَأَثَابَكُمْ غُمَّاً بِغَمٍّ لِّكَيْلاَ تَحْزَنُواْ عَلَى مَا فَاتَكُمْ وَلاَ مَا أَصَابَكُمْ وَاللّهُ خَبِيرٌ بِمَا تَعْمَلُونَ
[3:153]
When you ran off precipitately and did not wait for any one, and the Messenger was calling you from your rear, so He gave you another sorrow instead of (your) sorrow, so that you might not grieve at what had escaped you, nor (at) what befell you; and Allah is aware of what you do.
Behold! ye were climbing up the high ground, without even casting a side glance at any one, and the Messenger in your rear was calling you back. There did Allah give you one distress after another by way of requital, to teach you not to grieve for (the booty) that had escaped you and for (the ill) that had befallen you. For Allah is well aware of all that ye do.
When 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.