Yahya related to me from Malik from Nafi that a man asked Abdullah ibn Umar, "Sometimes I pray in my house, and then catch the prayer with the imam. Should I pray with him?" Abdullah ibn Umar said to him, "Yes," and the man said, "Which of them do I make my prayer?" Abdullah ibn Umar said, "Is that up to you? It is up to Allah. He will decide on whichever of them He wishes."
فَقَالَ إِنِّي أُصَلِّي فِي بَيْتِي ثُمَّ أُدْرِكُ الصَّلاَةَ مَعَ الإِمَامِ أَفَأُصَلِّي مَعَهُ فَقَالَ لَهُ عَبْدُ اللَّهِ بْنُ عُمَرَ نَعَمْ فَقَالَ الرَّجُلُ أَيَّتَهُمَا أَجْعَلُ صَلاَتِي فَقَالَ لَهُ ابْنُ عُمَرَ أَوَذَلِكَ إِلَيْكَ إِنَّمَا ذَلِكَ إِلَى اللَّهِ يَجْعَلُ أَيَّتَهُمَا شَاءَ