In The Name of Allaah, The Most Merciful, The Bestower of Mercy.
Alaah [The Most High] said:
وَعَسَىٰٓ أَن تَكۡرَهُواْ شَيۡـًٔ۬ا وَهُوَ خَيۡرٌ۬ لَّڪُمۡۖ وَعَسَىٰٓ أَن تُحِبُّواْ شَيۡـًٔ۬ا وَهُوَ شَرٌّ۬ لَّكُمۡۗ وَٱللَّهُ يَعۡلَمُ وَأَنتُمۡ لَا تَعۡلَمُونَ
And it may be that you dislike a thing which is good for you and that you like a thing which is bad for you. Allah knows but you do not know.” [AI-Baqarah, 2:216]
Imaam Ibnul Qayyim [rahimahullaah] said: There is for the servant -in this Aayah- a number of insightful guidelines, underlying benefits and advantages [of submitting to Allaah’s decisions]; for indeed if he knows that Al-Makrooh [i.e. what is hated] can bring forth Al-Mahboob [i.e. what is beloved], and vice versa, then neither would he feel safe from the harm that might occur from something that makes him happy nor would he lose hope whilst expecting a final source of happiness from a situation of harm. That is because he does not have [infinite] knowledge of the Awaaqib [i.e. the final outcomes], but Allaah knows that which he does not know.
There is nothing more beneficial for him than fulfilling Allaah’s commands, even if it is difficult for him in the beginning and his soul dislikes it, because all its end results will be good – a means to happiness, pleasure and joy. Likewise, there is nothing more harmful for him than doing what he has been forbidden, even if his soul desires and inclines towards it, for indeed all its end results [will lead to] pain, grief, evil and calamities. A distinguishing characteristic of [sound] intellect is that it prefers to bear little pain whose end results will lead to great enjoyment and abundant good, and it avoids that little enjoyment whose end results will lead to great pain and prolonged evil. The observations of an ignorant person do not permit him to [pay attention to the true or real] goals behind events that occur from the very beginning of an affair; but as for the sensible smart person, he always looks at the [true or real] goals behind those events. He looks at the praiseworthy and unpraiseworthy goals that are not obvious [to the ignorant one]. He sees what is forbidden as tasty food that is mixed with deadly poison; therefore, whenever he is urged towards eating that food due to its tastiness, he is turned away due to the poison in it. As for the commandments, he sees them as bitter medication that will lead to physical well-being and cure. Therefore, whenever he is turned away from the medication due to its bitterness, he is then urged towards it due to its benefits.
However, this requires outstanding knowledge by way of which a person can perceive the [praiseworthy and unpraiseworthy goals] behind those events that occur from the very beginning of an affair, as well as firm patience that would enable him to bear the difficulties upon the path towards achieving the expected goals. If he does not have certainty and patience, it would be difficult for him to achieve that; but if he has firm certainty and patience, he would be facilitated with ease whilst bearing every difficulty in his pursuit of everlasting good and enjoyment. [Source: An Excerpt from ‘Al-Fawaa’id’ pages 203-204. paraphrased] [Your feedback is welcome to improve the content of this article Jazaakumullaahu Khayran]