Alhamdulillaah wassalaatu wassalaam ‘alaa Rasuulillaah.
Allaah says (interpretation of the meaning): “And whatever of misfortune befalls you, it is because of what your hands have earned. And He pardons much.” [al-Shoora 42:30]
Ibn Katheer, rahimahullah, said: “[It means] whatever misfortune happens to you, O people, is because of evil deeds that you have already done, and ‘He pardons much’ refers to evil deeds – He does not punish you for them but He pardons them. ‘And if Allaah were to punish men for that which they earned, he would not leave a moving (living) creature on the surface of the earth…’ [Faatir 35:45 – interpretation of the meaning].”
Shaikh Saleh al Munajjid also said:
If the misfortune results from doing an act of obedience to Allaah, such as being wounded in jihaad, or losing money when migrating for the sake of Allaah, or losing a job because of becoming Muslim or increasing one’s commitment to Islam, then this is a trial (and not a punishment). Whoever bears it with patience will be rewarded, but if one reacts angrily then one will earn the wrath of Allaah. If the misfortune results from sin, such as sexually-transmitted diseases or illnesses caused by drinking alcohol and taking drugs, and so on, then this is the kind of punishment that comes in this world (as opposed to being deferred until the Hereafter). If the misfortune is connected neither to a good deed nor a sin – such as other kinds of disease and sickness, losing a child, or failing in business – then it depends on the person’s situation. If he is good and devout, it is a trial, and if he is sinful, it is a punishment. The misfortune may be a punishment to atone for sins, or it may be a trial aimed at raising a person’s status and increasing his hasanaat (good deeds/rewards) – this may be determined by whether a person is obedient or disobedient. A person should not praise himself, rather he should criticize himself for his shortcomings and strive to attain perfection. He will benefit from misfortunes in any case, if he has patience and hopes for reward. And Allaah knows best.
Therefore either case is a blessing in disguise.
… Abide by the truth even if your mind deserts you.