Imām Ibn Taimiyyah, may Allāh have mercy on him, said:
Asking [Allāh] for forgiveness wipes out sins and then removes the punishment, as Allāh the All-High says:
وَمَا كَانَ اللهُ مُعَذِّبَهُمْ وَهُمْ يَسْتَغْفِرُونَ
And Allāh was not going to punish them while they were asking for forgiveness. (Al-Anfāl, 33)
Jamiʿ Al-Masāʾil, vol. 6, p. 274.