Nafi reported,

A man asked Abdullah bin Umar, "I pray in my house, and then I arrive in time for the prayer with the imam. Should I pray with him?"Abdullah bin Umar said, "Yes."The man then asked, "Which of the two should I count as my prayer?"Ibn Umar replied, "Is that up to you? That is up to Allah. He counts whichever of the two He wills."

Malik 305

Sahih

و حدثني عن مالك

عن نافع

أن رجلا سأل عبد الله بن عمر فقال إني أصلي في بيتي ثم أدرك الصلاة مع الإمام أفأصلي معه فقال له عبد الله بن عمر نعم فقال الرجل أيتهما أجعل صلاتي فقال له ابن عمر أو ذلك إليك إنما ذلك إلى الله يجعل أيتهما شاء

مالك 305صحيح
Contents
Reference
Commentary
Ayat
Collection
Muwatta Malik
Book
Congregational prayer
Numbering
Laithi 305
Malik 305