The Women - 4:64
We have sent every messenger, by Allah´s permission, only that he may be obeyed. If they had come to you when they had wronged themselves and asked Allah for forgiveness of their sins, and the messenger had asked forgiveness for them, they would certainly have found Allah Forgiving and Merciful.
An example of going to the messenger and asking forgiveness from Allah:
Prophet Joseph/12:97
"They said: "O our father, ask forgiveness for our sins. We have indeed acted wrongly."
Prophet Joseph/12:98
"He said: "I will ask forgiveness for you from my Lord; He is Forgiving, Merciful."