Ibn Sirin said: He should first complete his prayer and then perform the prostration of forgetfulness.