God has created everything according to His divine wisdom, and has rendered many things to man's service. Clearly, many things in the universe, from the solar system to the ratio of oxygen in the atmosphere, from the animals that provide us meat and milk to water, have been created to serve man. If this fact is recognized to be evident, it follows that it is illogical to think this life has no purpose. Definitely, there is a purpose to this life, explained by God as follows:
I only created jinn and man to worship Me. (Surat adh-Dhariyat: 56)
Only a minority of humanity understand this purpose of creation and lead their lives thereby. God has granted us life on earth to test whether or not we will conform to this very purpose. Those who sincerely serve God, and those who rebel against Him, will be distinguished from one another in this world. All those blessings (his body, senses, property...) given to man in this world, are a means by which God tests him. In a verse of the Qur'an, God relates the following:
We created man from a mingled drop to test him, and We made him hearing and seeing. (Surat al-Insan: 2)
Man's duty in this world is to have faith in God and the hereafter, to conduct himself in compliance with the commands of the Qur'an, to observe the limits set by God, and to try to earn His good pleasure. The continuing trials of this life over time reveal those people who are committed to accomplish these tasks. Because God demands a true and sincere faith,—which is the kind of faith that is not attainable only by saying "I believe"—man must demonstrate that he has true faith in God and His religion, and that he will not swerve from the right path despite the cunnings of Satan. Similarly, he must demonstrate that he will not follow the disbelievers, nor prefer the desires of his own self over God's pleasure. His response to the events in his life will reveal all these qualities. God will create certain hardships, during which man must show patience, in order to expose the degree of his dedication to faith in God. This fact is stated in the Qur'an as follows:
Do people imagine that they will be left to say, "We believe," and will not be tested? (Surat al-'Ankabut: 2)
In another verse, God states that those who say, "We believe" will be tested:
Or did you imagine that you were going to enter Paradise without God knowing those among you who had struggled and knowing the steadfast? (Surah Al 'Imran: 142)
This being the case, disappointment in the face of difficulties would not be the right response to allow oneself to have. Such difficulties may be great ordeals or just trivial daily problems. A believer must consider all such circumstances as part of the trial placed upon him, place his trust in God, and conduct himself in compliance with His pleasure. In a verse of the Qur'an, those difficulties placed upon the believers are related as follows:
We will test you with a certain amount of fear and hunger and loss of wealth and life and crops. But give good news to the steadfast (Surat al-Baqara: 155)
The Prophet Muhammad (saas) also reminded the believers of this, by saying, "Whoever accepted it [God's trial], will enjoy God's Pleasure and whoever is displeased with it, will incur God's Displeasure." (At-Tirmidhi)
Not only will difficulties, but also blessings in this world serve to test man. God tries man with every benefit He bestows upon man, to see whether or not he will be thankful. As well, God creates many circumstances through which man adopt a certain attitude. In the midst of these trials, man may formulate a decision, either in compliance with God's pleasure, or his own soul. If he recognizes such an incident to be a trial from God, and conforms his conduct accordingly to earn God's pleasure, then he succeeds in his test. However, if his decision is in accordance to the dictates of his own soul, it will both be a sin, which he will greatly regret in the hereafter, and a source of anxiety in this world, as it troubles his conscience.
Indeed, God creates everything that happens in this world as a trial. Those events considered to be mere "coincidence" or "bad luck" by the ignorant, are actually circumstances created according to the great subtleties of a divine plan. Of this, God gives the example of Jews who broke the Sabbath, tempted by an abundance of fish:
Ask them about the town which was by the sea when they broke the Sabbath—when their fish came to them near the surface on their Sabbath day but did not come on the days which were not their Sabbath. In this way We put them to the test because they were deviators. (Surat al-A'raf: 163)
The Jews may have thought that the fish came forth to them on a Saturday by "coincidence," but, the event was predetermined as a trial for them by God. As this case makes clear, there is a divine purpose and a test in every occurrence in life. All that befalls a believer has been determined in order that he keep this notion in mind, and that he try to succeed at his test, and adopt a form of behaviour that is in compliance with the consent of God.