In the believers being overcome and defeated by their enemy, in their being subjugated by them, lies great and profound wisdom which none knows in detail save Allah, Mighty and Magnificent.
Amongst them is: their returning to the servitude of Allah, humbling themselves before Him, realising their dire need of Him, and their sincerely asking Him to aid them in vanquishing their enemy. Were the Muslims always victorious, ever the leaders, they surely would have become vainglorious and insolent. Were the Muslims always defeated and subjugated, never would this religion have been established and never would there be land ruled by the Truth. Therefore the All-Wise determined that the Muslims be victorious sometimes and defeated other times. When they are defeated they turn back in humility to their Lord, submitting to Him and asking Him for forgiveness; when they are victorious, they establish His religion, enjoin the good and forbid the evil – striving against His enemies and coming to the aid of His Awliyah.
Amongst which is: were the Muslims always victorious, people would have accepted his religion for ulterior motives, motives other than religion and following the Messenger, peace and blessings of Allah be upon him; and were the Muslims always defeated and subjugated, none would have accepted this religion. Therefore the All-Wise determined that the Muslims have sovereignty sometimes and at other times not and therefore sift those who intend Allah and His Messenger from those who do not.
Amongst which is: Allah loves that His servant show Him complete servitude in times of ease and difficulty, in time of well-being and tribulation, in time when they are in power and in times when they are subjugated. To Allah belongs a servitude as dictated by the circumstances one find himself in, it is these changing circumstances that serve to perfect servitude and make the heart firm. In the same way the body only becomes firm through experiencing heat and cold, hunger and thirst, weariness and labour, and their opposite. Therefore these trials and tribulations are actually a pre-requisite for the servants achieving perfection and achieving the fitness and uprightness that is sought of him.
Amongst which is: thought the tribulation of being subjugated by their enemy, the Muslims are purified and refined. Allah, Exalted is he, says, concerning the wisdom behind the Muslims’ defeat at the Battle of Uhud,
“Do not give up and do not be downhearted. You will be uppermost if you are believers. If you received a wound, they have already received a similar wound. We deal out such days to people turn by turn, so that Allah will know those who have faith and can gather martyrs from among you – Allah does not love the wrongdoers – and so that Allah can purge those who have faith and wipe out the disbelievers. Or did you imagine that you were going to enter the Garden without Allah knowing those among you who had struggled and knowing the steadfast? Muhammad is only a Messenger and he has been preceded by other Messengers. If he were to die or to be killed, would you turn on your heels? Those who turn on their heels do not harm Allah in any way. Allah will recompence the thankful.” (Ali Imran 3:139-144)
In these verses, Allah, Exalted is He, has mentioned numerous points of wisdom behind their defeat, after having assured them of being uppermost by virtue of their faith. He comforted them by saying that even though they had received a wound in obedience to Allah and His Messenger, the disbelievers too had received a wound in disobedience to Allah and His Messenger. Then He informed them that He deals out such days to people, turn by turn. Then He informed them that He did this so that he could know the believers; Allah, Glorious is He, knows everything, before its existence and after its existence, but He desired to witness them in reality, and know their faith being lived out. Then He informed them that He desired to gather martyrs from among them; martyrdom holds an exalted ranking with Him, this exalted ranking can only be attained by being killed in His path, it is one of the most beloved things to Him and one of the most beneficial things for the servant. Then He informed them that he desired to purge and refine the believers; purge them of sin through their returning to Him in repentance, sins that were the cause of their defeat; and He also informed them that despite this, He wished to wipe out the disbelievers. Then He rejected their supposition that they would enter Paradise without jihad and sabr, were they always victorious, none would have fought them so that they could have undertaken jihad and neither would they have had to display sabr at the harm inflicted on them by their enemy.
These are some of the points of wisdom behind the Muslims being defeated on occasion.
Trials and Tribulations: Wisdom and Benefits (Note that this extract is taken from Aid for the Yearning One in Resisting Shaytan) Imam ibn Qayyim al-Jawziyyah Pages 45-48