Did the Prophet (blessings and peace of Allah be upon him) revile anyone?
Question

 
There are two hadiths that I find difficult to understand.
The first hadith is in Saheeh al-Bukhaari, Kitaab al-Fadaa’il:
‘Abdullah ibn ‘Abd ar-Rahmaan ad-Daarimi narrated to us: Abu ‘Ali al-Hanafi narrated to us: Malik (ibn Anas) narrated to us from Abu’z-Zubayr al-Makki, that Abu’t-Tufayl ‘Aamir ibn Waathilah told him that Mu‘aadh ibn Jabal told him: We went out with the Messenger of Allah (blessings and peace of Allah be upon him) in the year of the campaign to Tabook. He put the prayers together, so he prayed Zuhr and ‘Asr together, and Maghrib and ‘Isha’ together, until one day he delayed the prayer, then he came out and prayed Zuhr and ‘Asr together, then he went back in and did not come out after that. Then he prayed Maghrib and ‘Isha’ together. Then he said: “Tomorrow, in sha Allah, you will come to the spring of Tabook, but you will not come to it until the forenoon. Then whoever of you comes to it should not touch its water until I come.” But when we came to it, two men had reached it ahead of us, and the spring was like a sandal strap with very little water (i.e., a thin stream of water). The Messenger of Allah (blessings and peace of Allah be upon him) said: “Did you touch the water?” They said: Yes. The Prophet (blessings and peace of Allah be upon him) reviled them and said to them whatever Allah willed that he should say. Then people put their hands into the spring, taking water little by little, until they had collected some in a vessel. Then the Messenger of Allah (blessings and peace of Allah be upon him) washed his hands and face in it, then he put the water back into the spring, and the spring began to flow abundantly. Or Ghareer said – Abu ‘Ali was not sure which of them said it – until the people had all drunk from it. Then he said: “Soon, O Mu‘aadh, if you live a long life, you will see this area filled with gardens.”
The second hadith is in Saheeh al-Bukhaari, Kitaab al-Birr wa’s-Silah wa’l-Adaab:
Zuhayr ibn Harb narrated to us: Jareer ibn al-A‘mash narrated to us, from Abu’d-Duha, from Masrooq, from ‘Aa’ishah who said: Two men entered upon the Messenger of Allah (blessings and peace of Allah be upon him), and he spoke to them about something that I do not know what it was, but they made him angry, so he cursed them and reviled them. Then when they left I said: O Messenger of Allah, if there is anyone who has attained anything good, these two (definitely) did not attain it. He said: “Why is that?” I said: You cursed them and reviled them. He said: “Do you not know what I have asked of my Lord? I said: O Allah, I am only human; if I curse or revile any of the Muslims, then make it a means of purification and reward for him.”
My question is:
If the Messenger (blessings and peace of Allah be upon him) is the one who taught us restraint in speech, and the Quran is full of verses which encourage good speech, and the seerah (Prophet’s biography) is full of stories which show how the Messenger (blessings and peace of Allah be upon him) was gentle in speech, even when the Jews were rude to him and our mother ‘Aa’ishah (may Allah be pleased with her) got angry because of that,
Then how can we reconcile these two hadiths with the rest of the saheeh texts, when these hadiths are also saheeh? May Allah reward you with good and include the answer in the balance of your good deeds.
Praise be to Allah.Forbearance, deliberation and restraint in speech are among the greatest characteristics of our Prophet Muhammad (blessings and peace of Allah be upon him), to the extent that praise for him because of these characteristics was mentioned in the Books of the previous Prophets before it was revealed in the Holy Quran. 
Allah, may He be glorified and exalted, says (interpretation of the meaning):
“And by the Mercy of Allah, you dealt with them gently. And had you been severe and harsh-hearted, they would have broken away from about you” [Aal ‘Imraan 3:159]. 
It was narrated that ‘Abdullah ibn ‘Amr ibn al-‘Aas (may Allah be pleased with him) said: 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-Bukhari (2125) 
This is how he (blessings and peace of Allah be upon him) was known among his companions, and the story of his conduct and noble attitude spread all over the world: 
It was narrated that Anas (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-Bukhari (6031). 
His compassion (blessings and peace of Allah be upon him) was not limited only to Muslims; rather his compassion and mercy also extended to many mushrikeen and hypocrites. 
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) 
If we want to start listing stories of his mercy in different situations, in which his words “rather I was sent as a mercy” were put into practice in various ways, all the available paper would not cover even a little of what has been proven in the saheeh Sunnah of such stories. 
At the same time, we say:
The fact that mercy and compassion were the prevailing attitude and practice of the Prophet (blessings and peace of Allah be upon him) does not mean that in some situations he did not behave as dictated by the situation and in accordance with human nature (by showing toughness). 
There are many examples that show a great deal of wisdom: 
1.
He (blessings and peace of Allah be upon him) was the ruler of the Muslims, and the ruler sometimes needs to use tough and strict measures in some situations, so as to maintain the well-being of the people and keep their affairs in order, and so that they will not take advantage of the ruler’s forbearance or tolerant nature. Do you not see how the Prophet (blessings and peace of Allah be upon him) gave instructions that adulterers be stoned, even though this punishment is severe and harsh, but maintaining order in society cannot be done except by establishing justice and implementing shar‘i rulings, otherwise too much forbearance may undermine people’s well-being and would ultimately lead to bad consequences. 
This is what al-Qaadi ‘Iyaad (may Allah have mercy on him) understood from the hadith of Mu‘aadh that is quoted in the question. He said: From it we learn that the ruler may use harsh words and impugn people for the purpose of rebuking and disciplining, within reasonable limits. End quote.
Ikmaal al-Mu‘allim (7/242) 
2.
Perhaps one of the purposes of that was for the Prophet (blessings and peace of Allah be upon him) to achieve the highest status in terms of character for which Allah, may He be glorified and exalted, had created this noble Messenger. We see this in the verse in which Allah, may He be glorified and exalted, says (interpretation of the meaning): “Indeed in the Messenger of Allah (Muhammad (blessings and peace of Allah be upon him)) you have a good example to follow for him who hopes in (the Meeting with) Allah and the Last Day and remembers Allah much” [al-Ahzaab 33:21]. Toughness and harshness in words, if done in appropriate situations, are something necessary which leaders and people in positions of authority in this ummah may resort to; their example in that regard is the Messenger of Allah (blessings and peace of Allah be upon him). Maintaining order can only be achieved by combining encouragement and deterrent (“carrot and stick”), and hope and fear. 
Therefore we find in the Prophet’s Sunnah examples of the toughness to which the Prophet (blessings and peace of Allah be upon him) resorted in some situations where that was required. 
It was narrated from ‘Aa’ishah (may Allah be pleased with her) that she said: The Messenger of Allah (blessings and peace of Allah be upon him) was never given the choice between two things but he would choose the easier of the two, so long as it was not a sin; if it was a sin he would be the furthest of the people from it. And the Messenger of Allah (blessings and peace of Allah be upon him) never took revenge for his own sake, unless the sacred limits of Allah were transgressed, in which case he would seek revenge for His sake.
Narrated by al-Bukhari (3560) and Muslim (2327) 
The point here is the words of ‘Aa’ishah (may Allah be pleased with her): “unless the sacred limits of Allah were transgressed, in which case he would seek revenge for His sake.” 
Another example of that is the two hadiths that are quoted in the question, and the reason that necessitated these harsh words on the part of the Prophet (blessings and peace of Allah be upon him) was mentioned in the report narrated by the commentators on the hadith, which was that the two men who had spoiled the spring for the Muslims during the Tabook campaign were hypocrites, who had done that deliberately in order to cause harm to the Muslims and cut off the water supply for them. So the Prophet (blessings and peace of Allah be upon him) punished them with the minimum penalty that a ruler could impose upon people, which was by rebuking them verbally and uttering harsh words. 
Al-Waaqidi (may Allah have mercy on him) said: 
According to what I was told, four of the hypocrites – Mu‘tab ibn Qushayr, al-Haarith ibn Yazeed at-Taa’i, Wadee‘ah ibn Thaabit and Zayd ibn Laseet – got there before him. End quote from ar-Rawd al-Anif (7/384). See also Maghaazi Ibn Ishaaq (605-606). 
Ibn Hazm (may Allah have mercy on him) said: 
These two men deserved to be reviled by the Prophet (blessings and peace of Allah be upon him) for going against his instructions not to touch the water. End quote.
Al-Ihkaam fi Usool al-Ahkaam (3/282) 
3.
The Prophet (blessings and peace of Allah be upon him) was not protected against making verbal errors and slips of the tongue. He may have thought that a particular person deserved to be cursed or impugned, so he impugned him on the basis of what appeared to be the case according to his outward actions, but it may have been the case that in fact he did not deserve to be impugned or cursed by the Prophet (blessings and peace of Allah be upon him). Therefore the Prophet (blessings and peace of Allah be upon him) urged his Lord to put that in the balance of good deeds of the one whom he reviled, and to let it be purification for him and expiation of his sins. 
Muslim (4706) narrated that Abu Hurayrah (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “O Allah, I am only human, so any man among the Muslims whom I revile or curse or flog, make it purification and mercy for him.” 
According to another report (4708) he said: “O Allah, I am making a covenant with You that You will never break. Any believer whom I harm, revile or flog, make that an expiation for him on the Day of Resurrection.”
An-Nawawi (may Allah have mercy on him) said: 
These hadiths highlight the compassion of the Prophet (blessings and peace of Allah be upon him) for his ummah, his concern for their interests, the precautions he took for them and his eagerness for anything that would benefit them. The last report highlights what is meant by the other reports, that are general in meaning, and demonstrate that his praying against him was only a means of mercy, expiation, purification and so on, if that person did not deserve to be prayed against, impugned, cursed and the like, and he was a Muslim. Otherwise, the Prophet (blessings and peace of Allah be upon him) did pray against the disbelievers and hypocrites, and that was not mercy for them. 
If it is said: How could he pray against someone who did not deserve to be prayed against or impugned or cursed and the like? The answer is that which was given by the scholars, which may be summed up in two points: 
1.
That if the person referred to did not in fact deserve that before Allah, may He be exalted, although he appeared outwardly to deserve it, so that it appeared to the Prophet (blessings and peace of Allah be upon him) that he did deserve it, based on some legitimate signs, but in reality he did not deserve it, the Prophet (blessings and peace of Allah be upon him) was instructed to rule according to how things appeared to be, and Allah is in charge of what is in people’s hearts. 
2.
What happened of him apparently reviling and praying against some individuals may not have been intended literally; rather it is something that was customary among the Arabs, without any intention behind it, such as when he said “may your hands be rubbed with dust” and “(May you become) barren and shaven-headed!” [an expression of disapproval] and so on. They did not really intend any prayer against a person by saying such words. But the Prophet (blessings and peace of Allah be upon him) was afraid lest these words be answered, so he asked his Lord, may He be glorified and exalted, and beseeched Him to make that mercy and expiation, and a means of closeness to Him, purification and reward. 
Such things happened only rarely; the Prophet (blessings and peace of Allah be upon him) was not foulmouthed, he never spoke intentionally in an offensive manner, and he was not given to cursing or seeking vengeance for himself. We have seen above in this hadith that they said: Pray against Daws and he said: “O Allah, guide Daws.” And he said: “O Allah, forgive my people for they do not know.” End quote. 
Sharh Saheeh Muslim by an-Nawawi 
And Allah knows best.