[Surah Al-Qalam 68:4]
Once the Prophet ﷺ dreamt that he was performing Umrah. Makkah was still under the control of Pagan Quraish. Since the dreams of the Prophets are considered to be a part of revelations, the companions were eager to proceed. There were around 1500 who joined the Prophet ﷺ and the journey proceeded. The Makkans were alerted and they wanted to stop the Prophet ﷺ (peace be upon him) so Khalid Ibn Waleed ( who was not a Muslim yet) blocked his way and there was a chance of a fierce battle but the Prophet ﷺ avoided a confrontation and changed his route. He picked the new road towards Makkah via Jeddah. Here too, he was faced with the stubborn Makkans and the pilgrims were forced to wait outside Makkah at Hudaibiyyah. There was tension in the air and Urwah was sent to the Prophet to convince him to return to Madinah.
Both sides talked and decided to solve the issue with diplomacy. A treaty was signed and Prophet ﷺ decided to slaughter the sacrificial animals outside Makkah and return to Madinah.
The Makkans were told to assure the Muslims to return the next year to perform Umrah. There were some mischief mongers among the Makkans who were not happy with the peace treaty. They hatched a plan to attack the sleeping Muslims at night. There were 80 of them who descended from the valley with a plan to kill the Muslims. They wanted to instigate the Muslims with that secret attack and make them fight with the Makkans who in return would finish the Muslims. It was Mohammed ibn Maslayma (Allah be pleased with him) who was keeping a tight vigil at night and spotted an unusual movement in the valley. He woke up the Muslims and got all the eighty invaders arrested and tied up. These people had come to cause a bloody mischief. By then even the Prophet ﷺ woke up.
Now these eighty were helpless against fifteen hundred Muslims and a punishment was awaited. He said - Since Allah has saved us from this attack, so I pardon them- The arrested men were set free and allowed to return to Makkah. This is a unique example of pardon.
There are instances when even companions like Abu Bakr (Allah be pleased with him) was instructed to pardon and be good to even those who harmed his honor.