Praise be to Allah.
Undoubtedly Allah, may He be exalted, is the most merciful of those who show mercy; His mercy encompasses all things, and He is more merciful to His slave than a mother to her child; indeed He, may He be glorified, is more merciful to a person than he is to himself.
This does not contradict the belief that the disbeliever will be punished and will be doomed to Hell for eternity on the Day of Resurrection. Discussion of this matter is based on three points:
Differentiation between the general mercy of Allah in this world, and His specific mercy in the Hereafter. In this world He, may He be glorified, bestows mercy in a general sense upon all His slaves, believers and disbelievers, obedient and disobedient. Thus He bestows provision upon them, gives them food and drink, heals them and grants them well-being, and other, innumerable types of mercy. Were it not for the mercy of Allah, no one would find air to breathe or water to drink, or any food or clothing. When he falls sick, were it not for Allah, he would never recover. In such terms people, in general, are equal. This is mercy in a general sense, which He grants to both His friends and His enemies.
As for His specific mercy in the Hereafter, it will be only for the believers, and the disbelievers will have no share of it.
The One Who made the mother merciful must inevitably be more merciful than her. Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said: “Allah is more merciful to His slaves than the most merciful of mothers to her child, for the One Who made her merciful must be more merciful than her.
End quote from Majmoo‘ al-Fataawa, 16/448
Reason dictates that Allah should be more merciful than every merciful individual among His creation, no matter how great a person’s mercy may be, because He, may He be glorified, is the One Who instilled mercy in their hearts. Al-Bukhaari (6000) and Muslim (2752) narrated that Abu Hurayrah said: I heard the Messenger of Allah (blessings and peace of Allah be upon him) say: “Allah made mercy in one hundred parts; He kept ninety-nine parts with Him and He sent one part down to earth. By virtue of that part, all creatures show compassion to one another, and even the mare lifts her hooves lest she harm her foal.”
There is no contradiction in the names and attributes of Allah, may He be exalted; rather they affirm one another and some imply others.
As He is merciful, He is also just. If someone were to say that He must show mercy to the disbeliever, for He is the most merciful of those who show mercy because mercy is His attribute, our response is: that would imply that He should not be just, but justice is also His attribute. Allah, may He be exalted, says (interpretation of the meaning):
“Or do those who earn evil deeds think that We shall hold them equal with those who believe (in the Oneness of Allah Islamic Monotheism) and do righteous good deeds, in their present life and after their death? Worst is the judgement that they make”
“Shall We treat those who believe (in the Oneness of Allah Islamic Monotheism) and do righteous good deeds, as Mufsidoon (those who associate partners in worship with Allah and commit crimes) on earth? Or shall We treat the Muttaqoon (pious), as the Fujjar (criminals, disbelievers, wicked, etc)?”
“Shall We then treat the (submitting) Muslims like the Mujrimoon (criminals, polytheists and disbelievers, etc.)?
What is the matter with you? How judge you?”
[al-Qalam 68:35, 36].
By His perfect wisdom and justice, Allah, may He be glorified, differentiates between His friends and His enemies, those who obey Him and those who disobey Him, those who worship Him and those who worship something other than Him. Otherwise, treating all of these people as equals would come under the heading of injustice that is contrary to justice and wisdom. If people treat their enemies and their friends equally, and they regard that as foolishness, ignorance and injustice according to human understanding, concepts and customs, then how about in the case of Allah, the Lord of the Worlds, may He be glorified?
Allah, may He be exalted, the most merciful of those who show mercy, created mankind, granted them provision and bestowed upon them innumerable blessings, then He sent the Messengers to them, and He sent down the Books, and guided them to faith and guidance; undoubtedly this is far greater than the mercy of a mother to her child.
When the believer obeys Him and the disbeliever disobeys Him, it is impossible for Him to treat them equally, because of the dictates of His wisdom, His knowledge, His justice, His promise (of reward) and His warning (of punishment); the disbeliever puts himself beyond the bounds of deserving this mercy which is only for some in the Hereafter.
Allah, may He be exalted, says (interpretation of the meaning):
“He said: (As to) My Punishment I afflict therewith whom I will and My Mercy embraces all things. That (Mercy) I shall ordain for those who are the Muttaqoon (pious), and give Zakat; and those who believe in Our Ayat (proofs, evidences, verses, lessons, signs and revelations, etc.)”
“Surely, Allah’s Mercy is (ever) near unto the gooddoers”
Ibn al-Jawzi (may Allah have mercy on him) said:
One of the signs of the general nature of His mercy is His sending the Messengers, and giving respite to the sinners. When the disbeliever denies Him, he displays stubbornness and so he is not deserving of mercy.
With regard to the specific nature of His mercy, it is for His believing slaves; He shows kindness towards them at times of hardship and of ease, which is greater than the kindness of a mother towards her child.
End quote from Kashf al-Mushkil, 1/94
To sum up: The special mercy of Allah in the hereafter will only be for His close friends and loved ones among those who to affirmed His oneness. As for those who died in a state of disbelief, stubbornness and arrogance, they will have no share of the mercy of Allah; rather they will be subject to His justice. And the Word of your Lord has been fulfilled in truth and in justice (cf. 6:115), the disbelievers will be surrounded by the very thing that they used to deny and mock at (cf. 6:10).
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
Allah, may He be exalted, will say to them – i.e., the disbelievers – when they ask Allah to bring them forth from the Fire, and they seek to appeal to Allah, may He be exalted, by virtue of His Lordship and their admission against themselves, “Our Lord! Bring us out of this; if ever we return (to evil), then indeed we shall be Zalimoon: (polytheists, oppressors, unjust, and wrong-doers, etc.)” [al-Mu’minoon 23:107], no mercy will reach them; rather justice will catch up with them, and Allah, may He be glorified and exalted, will say to them: “Remain you in it with ignominy! And speak you not to Me!” [al-Mu’minoon 23:108].
End quote from Majmoo‘ Fataawa wa Rasaa’il al-‘Uthaymeen, 8/28
And Allah knows best.