Maliks Muwatta Book 8, Hadith Number 13.

Section : Doing the Prayer Again with the Imam.

Yahya related to me from Malik from Nafi that Abdullah ibn Umar used to say, “Someone who prays maghrib or subh and then catches them with the imam should not repeat them.”

Malik said, “I do not see any harm in someone who has already prayed in his house praying with the imam, except for maghrib, because if he repeats it, he makes it even.”