حَدَّثَنَا مُحَمَّدُ بْنُ مُعَاذِ بْنِ عَبَّادٍ الْعَنْبَرِيُّ، حَدَّثَنَا أَبُو عَوَانَةَ، عَنْ يَعْلَى بْنِ عَطَاءٍ، عَنْ مَعْبَدِ بْنِ هُرْمُزَ، عَنْ سَعِيدِ بْنِ الْمُسَيَّبِ، قَالَ حَضَرَ رَجُلاً مِنَ الأَنْصَارِ الْمَوْتُ فَقَالَ إِنِّي مُحَدِّثُكُمْ حَدِيثًا مَا أُحَدِّثُكُمُوهُ إِلاَّ احْتِسَابًا سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ ‏"‏إِذَا تَوَضَّأَ أَحَدُكُمْ فَأَحْسَنَ الْوُضُوءَ ثُمَّ خَرَجَ إِلَى الصَّلاَةِ لَمْ يَرْفَعْ قَدَمَهُ الْيُمْنَى إِلاَّ كَتَبَ اللَّهُ عَزَّ وَجَلَّ لَهُ حَسَنَةً وَلَمْ يَضَعْ قَدَمَهُ الْيُسْرَى إِلاَّ حَطَّ اللَّهُ عَزَّ وَجَلَّ عَنْهُ سَيِّئَةً فَلْيُقَرِّبْ أَحَدُكُمْ أَوْ لِيُبَعِّدْ فَإِنْ أَتَى الْمَسْجِدَ فَصَلَّى فِي جَمَاعَةٍ غُفِرَ لَهُ فَإِنْ أَتَى الْمَسْجِدَ وَقَدْ صَلَّوْا بَعْضًا وَبَقِيَ بَعْضٌ صَلَّى مَا أَدْرَكَ وَأَتَمَّ مَا بَقِيَ كَانَ كَذَلِكَ فَإِنْ أَتَى الْمَسْجِدَ وَقَدْ صَلَّوْا فَأَتَمَّ الصَّلاَةَ كَانَ كَذَلِكَ ‏"
Translation
Narrated A person from the Ansar

Sa'id ibn al-Musayyab said: A man from the Ansar was present at death and said: I am narrating a hadith to you—I narrate it to you only seeking reward from Allah—I heard the Messenger of Allah, peace and blessings of Allah be upon him, saying: "When any of you performs ablution and excels in performing ablution, then goes out for prayer, he does not raise his right foot except that Allah, Mighty and Majestic, writes a good deed for him, and he does not place his left foot except that Allah, Mighty and Majestic, removes a sin from him. So let any of you draw near or let him distance [himself]. If he comes to the mosque and prays in congregation, he is forgiven. If he comes to the mosque when they have prayed some and some remains, he prays what he reaches and completes what remains—that is likewise. If he comes to the mosque when they have prayed, and he completes the prayer, that is likewise."