Asking Forgiveness for All Muslims
Question

I am asking about some du‘as, such as “O Allah, forgive the Muslims, men and women” and “O Allah, forgive us all.” Is it permissible to say such du‘as when the fulfilment thereof is contrary to the will of Allah? How can we respond to the one who doubts such du‘as when they are said at the times when du‘as are answered?
Praise be to Allah.Firstly: 
There is nothing wrong with praying for forgiveness for the Muslims, men and women, in general terms. There is evidence to the effect that it is permissible, such as the following: 
1.
The verse in which Allah, may He be exalted, says (interpretation of the meaning):
“So know (O Muhammad – peace and blessings of Allah be upon him) that La ilaha ill-Allah (none has the right to be worshipped but Allah), and ask forgiveness for your sin, and also for (the sin of) believing men and believing women.” [Muhammad 47:19]. 
It was narrated from ‘Asim al-Ahwal that ‘Abdullah ibn Sarjis said: I saw the Prophet (peace an blessings of Allah be upon him) and I ate bread and meat with him – or he said: thareed. He (the narrator) said: I said to him: Did the Prophet (peace and blessings of Allah be upon him) pray for forgiveness for you? He said: Yes, and for you. Then he recited this verse: “And ask forgiveness for your sin, and also for (the sin of) believing men and believing women” [Muhammad 47:19].
Narrated by Muslim, 2346. 
There are several opinions concerning the meaning of the phrase “and ask forgiveness for your sin”. One of these opinions is that this shows that it is obligatory to pray for forgiveness for all the Muslims. 
Al-Qurtubi (may Allah have mercy on him) said: 
It was said that this is addressed to him (the Prophet - peace and blessings of Allah be upon him)), but is meant for the ummah. According to this opinion, this verse obliges the individual to pray for forgiveness for all of the Muslims.
Tafseer al-Qurtubi, 16/242 
It was narrated that Ibn Jurayj said: I said to ‘Ata: Should I pray for forgiveness for the believing men and women? He said: Yes. The Prophet (peace and blessings of Allah be upon him) was commanded to do that, so that is obligatory on all the people. Allah said to His Prophet (peace and blessings of Allah be upon him): “And ask forgiveness for your sin, and also for (the sin of) believing men and believing women” [Muhammad 47:19]. I said: Do you say this supplication in the obligatory prayer? He said: No. I said: With whom do you start, with yourself or with the believers? He said: With myself, as Allah says: “And ask forgiveness for your sin, and also for (the sin of) believing men and believing women” [Muhammad 47:19]. 
2.
It was narrated that Abu Hurayrah (may Allah be pleased with him) said: The Messenger of Allah (peace and blessings of Allah be upon him) offered the funeral prayer and said: “O Allah, forgive our living and our dead, our young ones and our old ones, our males and our females, those of us who are present and those who are absent. O Allah, whomever You keep alive, keep him alive with faith and whomever you cause to die, cause him to die in Islam. Do not deprive us of the reward and do not cause us to go astray after this.” 
Narrated by at-Tirmidhi, 1024; Abu Dawood, 3201; an-Nasai, 1986. 
Ibn ‘Allan as-Siddeeqi (may Allah have mercy on him) said: 
“O Allah, forgive our living and our dead” means all of our living ones and dead ones, all the Muslims. 
Daleel al-Faliheen li Turuq Riyadh as-Saliheen, 6/240 
3.
This is the action of the angels (peace be upon them), as Allah says concerning them (interpretation of the meaning):
“And the angels glorify the praises of their Lord, and ask for forgiveness for those on the earth.” [ash-Shoora 42:5]. 
4.
It is the action of the Prophets, the Sahabah (Companions), the Tabi‘een (Successors) and all the scholars of the earlier and later times. 
(a)
Nooh (peace be upon him) said (interpretation of the meaning):
“My Lord! Forgive me, and my parents, and him who enters my home as a believer, and all the believing men and women.” [Nooh 71:28]
(b)
Ibraheem (peace be upon him) said (interpretation of the meaning):
“Our Lord! Forgive me and my parents, and (all) the believers on the Day when the reckoning will be established.” [Ibraheem 14:41]
(c)
It is what ‘Umar ibn al-Khattab (may Allah be pleased with him) did: 
‘Abd ar-Razzaaq narrated in al-Musannaf (3/111) that Ibn Jurayj said: ‘Ata told me that he heard ‘Ubayd ibn ‘Umayr narrate from ‘Umar ibn al-Khattab (may Allah be pleased with him) concerning Qunoot that he used to say: “O Allah, forgive the believing men and women and the Muslim men and women, reconcile between their hearts and set their affairs straight between them …”
Narrated by al-Bayhaqi in as-Sunan al-Kubra (2/210); he said: (It is) saheeh mawsool. 
Tuhfat al-Muhtaj ila adillat al-Minhaj, 1/410 
(d)
It was the last instructions of Ibn ‘Abbas (may Allah be pleased with him): 
In Fadl as-Salah ‘ala an-Nabiy by Ismaa‘eel al-Qadi (p. 63) it says in a report that was classed as saheeh (authentic) by al-Shaykh al-Albani: 
It was narrated from Ibn ‘Abbas (may Allah be pleased with him) that he said: Do not send blessings upon anyone except upon the Prophet (peace and blessings of Allah be upon him); however, one should offer supplication (du‘a) for forgiveness for the Muslims, male and female. 
(e)
It is what is said by all the believers, as Allah tells us about them in the verse (interpretation of the meaning):
“And those who came after them say: ‘Our Lord! Forgive us and our brethren who have preceded us in Faith, and put not in our hearts any hatred against those who have believed. Our Lord! You are indeed full of kindness, Most Merciful.’” [al-Hashr 59:10]. 
In the answer to question no. 104460 there is a statement that this du‘a is permissible – in fact it is encouraged. This was stated by Shaykh al-Islam Ibn Taymiyah and his student Ibn al-Qayyim. In the same answer several da‘eef marfoo‘ hadeeths (weak narrations attributed to the Prophet) on this topic have been quoted. 
Secondly: 
With regard to the opinion of those who object to this supplication on the grounds that Allah, may He be exalted, has decreed that there will not be forgiveness for all of the Muslims and that there is no doubt that some of them will enter the Fire, this is an objection that is not valid, because it is confusing the divine will and decree (qadr)) with the laws prescribed by Allah (shar‘). According to the divinely prescribed laws, we are commanded – or encouraged– to pray for forgiveness for all of the Muslims. This does not contradict that which has nothing to do with us of what Allah, may He be exalted, has decreed for some of the Muslims. One indication of this is found in the fact that the Prophet (peace and blessings of Allah be upon him) taught us du‘as (supplications) to ask for forgiveness and he instructed the Muslims to recite them and say them. We know that it will not be accepted from some of those who say it. What we have mentioned above of evidence also confirms that those who say that this du‘a is not right are mistaken, and it confirms that praying for forgiveness for all the Muslims, male and female, is something valid. The earliest we have come across of those who objected to this du‘a was Abu’l-‘Abbas al-Qarrafi (d. 684), who regarded offering supplication for this as something haram (impermissible)! He said in al-Furooq ma‘a Hawashihi (4/463): 
“The fifth category of haram things that do not constitute kufr is when the one who is offering supplication asks Allah for something contrary to what ahad reports state is going to happen. Why I mention “ahad reports”, as opposed to mutawatir reports, is because asking Allah for something not to happen in that case (i.e., when there are mutawatir reports that state it will happen) is akin to kufr, as stated above. There follow some examples of that: 
(i)
When he says “O Allah, forgive the Muslims all their sins,” although the saheeh hadeeths (authentic reports) indicate that a group of the Muslims will inevitably enter Hell and be brought forth from it, with or without intercession. Their entering Hell will only be because of their sins. If all of the Muslims were forgiven all of their sins, no one would enter Hell. So this supplication implies rejection of those saheeh hadeeths! So it (this du‘a) is an act of disobedience, but it is not kufr (disbelief) because you are rejecting ahad reports, and labelling something an act of kufr only applies to denying something that is well established in Islam or known from mutawatir reports. 
With regard to the angels praying for forgiveness for the believer by saying “so forgive those who repent” [Ghafir 40:7] and “and [they] ask for forgiveness for those on the earth”[ash-Shoora 42:5], these words are not general in meaning, and do not apply to all people. Even if we were to assume that they are general in meaning, then we should understand them as meaning that what they meant was that it was exclusively for some people (and not for all). 
Al-Furooq ma‘a Hawamishihi, 4/463-465 
Abu’l-Qasim ibn al-Shat al-Maliki (may Allah have mercy on him – d. 723 AH) refuted this argument by saying, as it says in Hamish al-Furooq al-Musamma Idrar ash-Shurooq (4/488): 
What he said about these and similar du‘as constituting sin is a mere claim. Why should it be that one should only offer supplication for that which is possible to happen? I do not know of any proof or evidence for that. 
Why is it not possible that Allah should enjoin people to ask for forgiveness for the sins of every believer, even though He has decreed that some of them will not be forgiven? 
Moreover, what he said about these two verses –“so forgive those who repent” [Ghafir 40:7] and “and [they] ask for forgiveness for those on the earth”[ash-Shoora 42:5] – not being general in meaning is a grievous mistake. 
To sum up, the argument of this man (al-Qarrafi) is far-fetched, his claim has no proof and there is no need for it; he was confused and mistaken.
End quote. 
Al-Shaykh ‘Abd al-Kareem al-Khudayr (may Allah preserve him) was asked: 
What do you think of the view that du‘a against the kafirs is a kind of transgression because Allah knew that they would exist until the Day of Resurrection? 
He replied: 
The Muslim is required to adhere to the teachings of Islam. With regard to the divine will and decree, it has nothing to do with him. One may say: Why do you pray for all of the Muslims when Allah knows that some of them will die whilst committing major sin? Yes, there are some scholars who say that this is not allowed and that it is not permissible to pray for all of the Muslims. There are some who disallow praying for all of the Muslims because according to Allah’s knowledge, there are some who will die whilst persisting in major sins, and this supplication is contrary to the divine will and decree. So based on this flawed argument, you should not pray for yourself, because you do not know how your life will end! And you should not pray for your child, because Allah knows best how he will be! Rather we say: you are commanded to offer supplication, and this is what Allah has prescribed; as for the divine will and decree, it belongs to Allah and has nothing to do with you.
Sharh al-Muwatta, Kiaab al-Janaiz, Bab an-Nahy ‘an al-Buka ‘ala al-Mayyit. 
And Allah knows best.