Allaah (God) Almighty, is most merciful and compassionate, without any doubt. Yet his actions can not be fully comprehended by our incompetent minds. What simplifies this issue is that we all agree that Allaah is fair, just, wise and knowing. That means whatever he-Almighty- does, is with a legitimate purpose although we may not be able to understand, just why. For example, a caring and loving doctor and father may be forced to amputate the leg of his only son. There is no doubt that this father loves his son. Yet his action was for the sake of this beloved son, although it may seem cruel to those who do not understand the circumstances. Allah –Almighty – has the greater and higher example, and it is not to any of his creatures to question his doings as it is mentioned in Sura 21 verse 23 (interpreted means:
“He cannot be questioned for His acts, but they will be questioned (for theirs)”.
It is a Muslim’s belief that suffering of pain, hunger, tragic accidents etc, are due to one’s sins, for Allaah wants this suffering to erase these sins which were made by this Muslim. Allaah says in Sura 42 verse 30 interpreted means:
“Whatever misfortune happens to you, is because of the things your hands have wrought, and for many (of them) He grants forgiveness”.
It is also apparent that man in times of crisis gets closer to Allaah and starts repenting, while in times of ease and comfort he is far from remembering the blessings of Allaah and he uses these gifts and blessings in committing sin after sin.
Allaah -Almighty- has shown man the path of good and evil, and he gave himthe power and will to choose. Therefore, man is accountable to his deeds and the punishment he receives for them, for life in this world is merely a test, but the results are to be known in the hereafter and Allaah knows best.
source: islamic awakening