The Prayer for the People of Ta'if
historicalShaykh Yasir Qadhi explains:
As they withdrew, the Companions urged, "O Messenger of Allāh, invoke Allāh against Thaqīf!", and all raised their hands expecting a curse upon the city that had once stoned and bloodied and driven him out. Instead he said, اللَّهُمَّ اهْدِ ثَقِيفًا وَأْتِ بِهِم, "O Allāh, guide Thaqīf and bring them to us." A second time he prayed for the very people who had tortured him twenty years before, exactly as he had at Ṭāʾif the first time. And Allāh answered: Thaqīf accepted Islam the following year.
The goal of Islam is not vengeance and blood but mercy and guidance, if any deserved a curse it was Thaqīf, yet he prayed for them. And its deepest lesson: this world is never a world of total victory. He had won Mecca, yet Ṭāʾif was withheld; a bed of roses is not promised even to the Messenger of Allāh ﷺ, you win some and lose some, and losing is no sign of Allāh's anger but the way of a world made for testing, with Paradise, not this life, as the reward.