Ibrahim said: He should prostrate with the imam, and when the imam has finished, he should stand up and complete the rest of the prayer.