وَمَآ اَرْسَلْنَا مِنْ رَّسُوْلٍ اِلَّا لِيُطَاعَ بِاِذْنِ اللّٰهِ ۗوَلَوْ اَنَّهُمْ اِذْ ظَّلَمُوْٓا اَنْفُسَهُمْ جَاۤءُوْكَ فَاسْتَغْفَرُوا اللّٰهَ وَاسْتَغْفَرَ لَهُمُ الرَّسُوْلُ لَوَجَدُوا اللّٰهَ تَوَّابًا رَّحِيْمًا ( النساء: ٦٤ )
Wa maa arsalnaa mir Rasoolin illaa liyutaa'a bi iznil laah; wa law annahum 'iz zalamooo anfusahum jaaa'ooka fastaghfarul laaha wastaghfara lahumur Rasoolu la wajadul laaha Tawwaabar Raheemaa (an-Nisāʾ 4:64)
And We did not send any messenger except to be obeyed by permission of Allah. And if, when they wronged themselves, they had come to you, [O Muhammad], and asked forgiveness of Allah and the Messenger had asked forgiveness for them, they would have found Allah Accepting of Repentance and Merciful. (An-Nisa  : 64)
1 Mufti Taqi Usmani
We did not send any Messenger but to be obeyed by the leave of Allah. Had they, after having wronged themselves, come to you and sought forgiveness from Allah, and had the Messenger prayed for their forgiveness, they would certainly have found Allah Most-Relenting, Very-Merciful.