The Spoils of War - 8:5 Indeed, your Lord took you out of your home for the fulfillment of a certain plan. A group of the believers disliked it.
Everything that happens is according to Allah's plan:
The Mountain/52:42 Or do they wish to carry out a plan? But the disbelievers themselves are condemned to a plan.

The Thunder/13:42 And those before them also set up schemes, but to Allah belongs all schemes. He knows what each person wins. And the disbelievers will know to whom the victory belongs.

The Spoils of War/8:30 The disbelievers were plotting to neutralize you or to kill you or to drive you away. If they are plotting, Allah is plotting. Allah is the most skillful of plotters.

Prophet Jonah/10:21 "When We bestow on mankind a mercy after a hardship that has touched them, they immediately devise a plan against Our signs and miracles. Say: "Allah is quicker in making plans. Our messengers record all your plans."

The Spoils of War/8:42 When you were on the far side of the valley and they were on the far side of the valley. And the caravan was lower than you. If you had decided on this encounter, you would have disagreed about it. But Allah was carrying out a pre-planned deed. So that that which is destroyed may be destroyed with a clear proof, and that which lives may be kept alive with a clear proof. Allah is All-Hearing, All-Knowing.

Ta-Ha/20:40 Remember when your sister went and said, ´Shall I show you someone to take care of him? So We returned you to your mother so that her eyes would be enlightened and she would not grieve. Even when you had killed a man, We saved you from sorrow and put you through various tests. Now you have come back, Moses, after many years among the people of Medina, according to a definite plan.

The Iron/57:22 There is nothing in the earth and among you that is not recorded in a Book before We created it. Surely this is easy for Allah.