Praise be to Allah.
Contentment with the will and decree of Allah when He decrees that there should befall a person that which is contrary to what he loves and prefers is to be regarded as an act of worship that is recommended and is one of the highest levels that may be attained by people of faith.
Ibn al-Qayyim (may Allah have mercy on him) said:
Contentment with the universal decree that brings about what is contrary to what a person likes and prefers, and comes in a way that does not suit him and is not something that he would choose for himself, is recommended and is one of the highest levels that may be attained by people of faith. There are two views as to whether it is obligatory. This applies to matters such as sickness, poverty, annoyance and harm caused by others, heat, cold, pain and so on.(Madarij as-Salikin, 3/1930-1931).
Contentment is superior to patience, for it is patience and more. The one who is patient refrains from showing discontent and complaining, even though he feels distressed and wishes that this calamity had never befallen him.
As for the one who is content, in addition to refraining from showing discontent and complaining, he is reassured and at ease with the divine decree.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
Patience is obligatory according to scholarly consensus, and superior to that is contentment with the divine decree.
It was said that contentment is obligatory, and it was said that it is recommended. The latter is the correct view.
And superior to all of that is showing gratitude to Allah for the calamity, because of what he sees of the blessings that Allah bestows upon him by means of it, as He has made it a cause of expiating his sins and raising him in status, and it causes him to turn to Him, beseech Him, sincerely put his trust in Him and put his hope in Him and not in other people.(Majmu` al-Fatawa, 11/260).
Contentment is not invalidated by feelings of pain or grief, for a person may feel pain because it is natural for humans to feel pain. But despite that, he is content with what Allah has willed and decreed.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
Feeling distress in one’s heart because of the calamity is not contrary to contentment, according to the consensus of wise people, and no one is required not to feel that, let alone think that it is a sin or that the one who feels like that should lose his status of prophethood.(Jami` al-Masa’il, 4/75).
Ibn al-Qayyim (may Allah have mercy on him) said:
It is not stipulated that contentment with the divine decree means that one should not feel pain or discomfort with what one dislikes. Rather it is stipulated that he should not object to the divine decree or complain about it. Therefore some people could not understand how anyone could be content with the divine decree whilst also disliking and feeling distress. They rejected this idea and said: this is not possible for human nature; rather all that is required is patience, otherwise how could he be content with what he dislikes, when they are opposites?
However the correct view is that there is no contradiction between them, and that feeling pain and disliking a thing does not contradict being content with it, just as the sick person is content to take medicine that he detests, and the one who is fasting on a hot day is content with what he goes through of the pain of hunger and thirst, and the mujahid who fights in Allah’s cause is content with what he endures of the pain of wounds and the like.(Madarij as-Salikin, 3/1888-1889).
What this means is that in one way a person may be content with a calamity, and in another way he may dislike it and feel the pain of it.
What proves this is the fact that the greatest of people in status before Allah, namely our Prophet Muhammad (blessings and peace of Allah be upon him) himself felt grief when calamity befell him.
It was narrated that Anas ibn Malik (may Allah be pleased with him) said: We went with the Messenger of Allah (blessings and peace of Allah be upon him) to visit Abu Sayf the blacksmith, who was the foster-father of [the Prophet’s son] Ibrahim (peace be upon him). The Messenger of Allah (blessings and peace of Allah be upon him) picked Ibrahim up and kissed him and smelled him. Then we went to visit him again after that – when Ibrahim was taking his last breaths – and the eyes of the Messenger of Allah began to flow with tears. `Abd ar-Rahman ibn `Awf (may Allah be pleased with him) (blessings and peace of Allah be upon him) said to him: Even you, O Messenger of Allah? He said: “O Ibn `Awf, it is mercy.” Then he wept some more, and said: “Indeed the eyes weep and the hearts grieve, but we do not say anything except that which pleases our Lord. And indeed we are grieved by your departure, O Ibrahim.” Narrated by Muslim (1303) and Muslim (2315).
This clearly indicates that the Prophet (blessings and peace of Allah be upon him) grieved at the loss of his son Ibrahim, and this is definitely not contrary to contentment with the divine decree, because it is part of human nature to feel grief.
The same applies to the grief of Ya`qub (peace be upon him).
Allah, may He be Exalted, says:
{And he turned away from them, and said: Alas for Yusuf! And his eyes became white with grief, and he was burdened with silent sorrow.
They said: By Allah, you will not cease to remember Yusuf until your health is ruined or you die.
He said: I only complain of my distress and sorrow to Allah, and I know from Allah what you do not know} [Yusuf 12:84-86].
Ibn al-`Arabi (may Allah have mercy on him) said:
Ya`qub was grieving to the extent that we have explained, but his grief was something natural that he kept in his heart, and did not express verbally anything that was contrary to the teachings of religion, as the Prophet (blessings and peace of Allah be upon him said regarding his son, according to the sound report: “Indeed the eyes weep and the hearts grieve, but we do not say anything except that which pleases our Lord. And indeed we are grieved by your departure, O Ibrahim.” And he (blessings and peace of Allah be upon him) also said in As-Sahih: “Allah does not punish for tears of the eye or grief of the heart; rather He punishes or shows mercy because of this” – and he pointed to his tongue.
This is Allah’s grace (that He does not hold people accountable for what they feel), when He knows that people are unable to be completely steadfast and patient. Therefore He gave permission to them to weep and grieve, and He does not bring them to account for that. But He has forbidden bad speech (that is, complaining). So He forbade what He forbade, and He enjoined acceptance and contentment with whatever Allah decrees should happen, especially immediately after it happens.
The best way to express pain is to ask Allah to relieve the calamity, as Ya`qub said: {I only complain of my distress and sorrow to Allah, and I know from Allah what you do not know} [Yusuf 12:86] of His beautiful decrees, wondrous kindness and the blessings that He bestows upon His slaves (as a result of them showing patience).(Ahkam al-Qaran, 3/1104).
And Allah knows best.