The Prophet’s prayer for mercy for those whom he impugned
Question

How sound is this hadith: “O Allah, I am only human, so if I impugn or curse or flog any man among the Muslims, make it a cause of purification and mercy for him”?
Praise be to Allah.Firstly:
Among the greatest characteristics of our great Prophet (blessings and peace of Allah be upon him) were his forbearance, deliberation and restraint in speech. Allah the Creator, may He be glorified and exalted, described him thus in the Qur’an. He, may He be glorified, says (interpretation of the meaning):
“So by mercy from Allah, [O Muhammad], you were lenient with them. And if you had been rude [in speech] and harsh in heart, they would have disbanded from about you”
[Aal ‘Imraan 3:159].
He was also described thus in the previous scriptures, as ‘Abdullah ibn ‘Amr ibn al-‘Aas (may Allah be pleased with him) said:
By Allah, he is described in the Torah in some of the same terms as in the Qur’an… he is not harsh and aggressive, and he does not make a noise in the market-place; he does not repay evil with evil, rather he overlooks and forgives. Narrated by al-Bukhaari (2125).
The Sahaabah (may Allah be pleased with them) also knew him to be like that, from seeing how he lived. It was narrated that Anas ibn Maalik (may Allah be pleased with him) said: The Prophet (blessings and peace of Allah be upon him) was not given to impugning others, he was not foulmouthed, and he was not given to cursing. He used to say to one of us – when wanting to rebuke him –: “What is the matter with him? May his forehead be rubbed with dust.”
Narrated by al-Bukhaari (6031). 
In some instances, he (blessings and peace of Allah be upon him) even refused to pray against the mushrikeen even though they deserved to be cursed. It was narrated that Abu Hurayrah (may Allah be pleased with him) said:
It was said: O Messenger of Allah pray against the mushrikeen! He said: “I was not sent as an invoker of curses, rather I was sent as a mercy.”
Narrated by Muslim (2599).
Secondly:
The hadith mentioned is a saheeh hadith which is proven to be from the Prophet (blessings and peace of Allah be upon him).
It was narrated from a number of the Sahaabah (may Allah be pleased with them).
It was narrated from Abu Hurayrah (may Allah be pleased with him) that the Prophet (blessings and peace of Allah be upon him) said: “O Allah, any believer whom I impugn, make it a means by which he will draw close to You on the Day of Resurrection.”
Narrated by al-Bukhaari (6361) and Muslim (2601). A similar report was narrated by Imam Ahmad in al-Musnad (3/33) from Abu Sa‘eed al-Khudri. In al-Musnad (5/294) it is also narrated from Abu’s-Sawwaar, from his maternal uncle. Therefore this hadith is one of the soundest hadiths.
It was narrated from Jaabir ibn ‘Abdillah (may Allah be pleased with him) that the Prophet (blessings and peace of Allah be upon him) said: “I am only human, and I have made a deal with my Lord, may He be glorified and exalted, that any Muslim whom I impugn or scold, that will be a cause of purification and reward for him.”
It was narrated that Anas ibn Maalik (may Allah be pleased with him) said:
Anas ibn Maalik said: Umm Sulaym, who was the mother of Anas, had an orphan girl in her care. The Messenger of Allah (blessings and peace of Allah be upon him) saw the orphan girl and said: “Is it you? You have grown, may you never grow older.” The girl went back to Umm Sulaym weeping, and Umm Sulaym said: What is the matter with you, O my daughter?  The girl said: The Prophet of Allah (blessings and peace of Allah be upon him) prayed against me, he prayed that I would never grow old; now I will never grow any older. Umm Sulaym went out, hastily wrapping her khimaar around her head, until she met the Messenger of Allah (blessings and peace of Allah be upon him). The Messenger of Allah (blessings and peace of Allah be upon him) said to her: “What is the matter with you, O Umm Sulaym?” She said: O Prophet of Allah, did you pray against my orphan girl? He said: “What do you mean, O Umm Sulaym?” She said: She says that you prayed that she might never grow older. The Messenger of Allah (blessings and peace of Allah be upon him) smiled and said: “O Umm Sulaym, do you not know that I made a deal with my Lord? I said: I am only human; sometimes I am pleased as other human beings are pleased and sometimes I become angry as other human beings become angry. Anyone among my ummah whom I pray against and they do not deserve it, make that a cause of purification for him, and a cleansing (from sin), and a means by which he may draw close (to Allah) on the Day of Resurrection.”
Narrated by Muslim (2603).
Thirdly:
This hadith is a refutation of those who exaggerate about the Prophet (blessings and peace of Allah be upon him). It clearly states that he was human and got angry as other humans get angry. Even though he was the most knowledgeable of mankind about Allah, the one who most feared Allah, and the one who was furthest removed from all sins and errors, he was not infallible and protected from error in his judgement and he was not infallible and protected from such errors, that he made in very rare circumstances, because he was human. But he (blessings and peace of Allah be upon him) was infallible and protected in the sense that if he made any error in judgement, it would not be approved and left alone; rather revelation would come down to him to correct his errors. Moreover, with regard to words he said in a moment of anger that had to do with infringements on the rights of other people, such as impugning and cursing, whatever he uttered would not lead to bad consequences, if it was said in the case of one who did not deserve that, on the basis of the hadith which refers to Allah’s promise in that regard, that He would make it a cause of purification and reward for him, and a means of him drawing close to Allah on the Day of Resurrection.
Shaykh al-Albaani (may Allah have mercy on him) said:
Some people of whims and desires and blind emotions may hasten to reject such hadiths on the grounds of claiming to show respect and venerate to the Prophet (blessings and peace of Allah be upon him) and declaring him to be above uttering such words. There is no need for this rejection, because the hadith is saheeh; in fact in our view it is mutawaatir. It was narrated by Muslim from ‘Aa’ishah and Umm Salamah, as we have noted, and also from Abu Hurayrah and Jaabir (may Allah be pleased with them). It was also narrated from Salmaan, Anas, Samurah, Abu’t-Tufayl, Abu Sa‘eed and others. See: Kanz al-‘Ummaal (2/124). Venerating and showing respect for the Prophet (blessings and peace of Allah be upon him), as prescribed in Islamic teachings, can only be done by believing in everything that is proven to be soundly narrated from him (blessings and peace of Allah be upon him). Thus one will combine belief in the Prophet (blessings and peace of Allah be upon him) as both slave and Messenger, without going to the extremes of either exaggeration or disrespect. He (blessings and peace of Allah be upon him) was human, according to the Qur’an and Sunnah, but he is the leader of humanity and the best of them all, according to the saheeh hadiths, and as is indicated by the story of his life and his seerah (biography), and by what Allah, may He be exalted, blessed him with of a noble attitude and praiseworthy characteristics, which were never perfected and completed in any human as they were in him (blessings and peace of Allah be upon him). Allah the Almighty spoke the truth when He said (interpretation of the meaning): “And indeed, you are of a great moral character” [al-Qalam 68:4].
End quote from as-Silsilah as-Saheehah (no. 84).
Fourthly:
The scholars discussed this and similar hadiths noting that, in addition to being mutawaatir, it constitutes definitive proof that refers to the Prophet’s perfect manners and attitude, his compassion towards his ummah, his forbearance and his knowledge.
Imam an-Nawawi (may Allah have mercy on him) said:
These hadiths clearly highlight the extent of the Prophet’s compassion towards his ummah, how he cared about their well-being, how he gave them the benefit of the doubt and his desire for everything that would benefit them.
This particular report that is mentioned towards the end explains the other reports that speak in general terms, and note that the Prophet’s du‘aa’ against a person will be turned into mercy, expiation, purification and so on, if he does not deserve that du‘aa’ against him, impugning, cursing and so on, and he was Muslim. Otherwise, we know that the Prophet (blessings and peace of Allah be upon him) prayed against the disbelievers and hypocrites, and that cannot be a mercy for them.
If it is asked: how could he pray against someone who did not deserve to be prayed against, impugned or cursed, and so on? The answer is as the scholars said, which may be summed up in two points:

What is meant is that he does not deserve that in the sight of Allah, may He be exalted, or in reality, but outwardly he appeared to deserve that, and it seemed to the Prophet (blessings and peace of Allah be upon him) that he deserved that, based on the person’s outward actions that appeared to be contrary to the teachings of Islam, but in reality that person did not deserve that, but the Prophet (blessings and peace of Allah be upon him) was enjoined to judge people on the basis of what they appeared to be, and Allah would take care of what was in their hearts.
What happened of his impugning that person, praying against him and so on was not meant literally; rather it was customary in the speech of the Arabs to say phrases without meaning them literally, such as saying “May your right hand be rubbed with dust” or “May you be barren and shaven-headed” [to a woman]; and – in this hadith – “may you never grow older”; and – in the hadith of Mu‘aawiyah – “May you never be satisfied with food”, and so on. They did not mean any of that literally. The Prophet (blessings and peace of Allah be upon him) was afraid that his du‘aa’ might be answered when he did not mean it, so he asked his Lord, may He be glorified and exalted, to make that a mercy and expiation, a means of drawing close to Him, purification and reward.

This happened very rarely, and such incidents were few and far between. The Prophet (blessings and peace of Allah be upon him) was not given to foul speech or cursing, and he would not seek revenge for himself. It has been noted above that they said: Pray against Daws, but he said: O Allah, guide Daws” and he said: “O Allah, forgive my people for they do not know.” And Allah knows best.
End quote from Sharh Muslim (16/152).
In his commentary on a hadith, concerning which there was a similar issue, Ibn al-Atheer (may Allah have mercy on him) explained this matter and said:
Concerning this du‘aa’ of the Prophet (blessings and peace of Allah be upon him), it may be understood in two ways:

That he was surprised at how the questioner was so eager and pushy in his pursuit of what he wanted.
When he saw how pushy he was, his human nature overtook him and he prayed against him. In another hadith, he said: “O Allah, I am only human, so if I pray against someone, make my supplication a mercy for him.”

End quote from an-Nihaayah fi Ghareeb al-Hadeeth (1/71).
See also: al-Aadaab ash-Shar‘iyyah by Ibn Muflih (1/81-83, 343-344).
The most appropriate explanation that is closest to the apparent meaning of the text is that this cursing, impugning, flogging or beating that is mentioned in these texts was directed against someone who did not deserve it, either because the Prophet (blessings and peace of Allah be upon him) thought that he deserved it, and he judged the individual according to how he appeared to be, when in fact he did not deserve it, but the Prophet (blessings and peace of Allah be upon him) – because he was human – had no knowledge of the unseen; or because he was overtaken by his human nature, and thus got angry in this situation with someone who did not deserve to be impugned, and because of that these hadiths always state that the Prophet (blessings and peace of Allah be upon him) said: “I am only human”, but what he said is free of bad consequences, so what results from the curses and impugning would not happen to the one who did not deserve it. In fact, Allah promised His Prophet that it would be the opposite of that, so it would be expiation and the means of drawing closer to Allah, and this person would have no grievance and no score to settle with the Prophet (blessings and peace of Allah be upon him); rather it might be a blessing in his case, as he would attain that status and expiation.
See: Siyar A‘laam an-Nubalaa’ by adh-Dhahabi (3/123-124, 14/130).
And Allah knows best.