That’s for Allah to purge the believers and destroy the unbelievers.
Did you suppose that you would enter Paradise before Allah had tested those of you who really strived and tested those who are the patient?
And you had certainly wished for death (martyrdom) before you encountered it, and you have now seen it while you were looking on (death for martyrdom).
And Muhammad is no more then a Messenger, and Messengers have passed away before him as well. If he dies or is killed, will you then turn back on your heels? And whoever turns back upon his heels, he will by no means do harm to Allah in the least; and Allah will reward the grateful soon.
No one dies except by Allah’s Leave and it (death) is an appointed term; and whoever desires the reward of this world, I shall give him of it, and whoever desires the reward of the Hereafter, I shall give him of it; and We will reward the grateful soon.
And there are many amongst the prophets and along fought with him Ribbiyyûn (religious guides possessing knowledge and insight). But they never lost assurance due to what afflicted them in the cause of Allah, nor did they weaken or submit. And Allah loves the patient ones.
And their saying was no other than that they said: “Our Lord! Forgive us our sins and our extravagance in our affair, and make firm our feet and help us against the disbelieving people”.
So Allah gave them the reward of this world and better reward of the Hereafter and Allah loves the Muhsinûn.