Aal-'Imran - 3:166

وَمَا أَصَابَكُمْ يَوْمَ الْتَقَى الْجَمْعَانِ فَبِإِذْنِ اللّهِ وَلِيَعْلَمَ الْمُؤْمِنِينَ
[3:166]
And what befell you on the day when the two armies met (at Ohud) was with Allah's knowledge, and that He might know the believers.
What ye suffered on the day the two armies Met, was with the leave of Allah, in order that He might test the believers,-
That which befell you, on the day when the two armies met, was by permission of Allah; that He might know the true believers;