Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
muslim:59dAbū Naṣr al-Tammār And ʿAbd al-Aʿlá b. Ḥammād > Ḥammād b. Salamah > Dāwud b. Abū Hind > Saʿīd b. al-Musayyab > Abū Hurayrah

even if he observed fast and prayed and asserted that he was a Muslim.  

مسلم:٥٩dوَحَدَّثَنِي أَبُو نَصْرٍ التَّمَّارُ وَعَبْدُ الأَعْلَى بْنُ حَمَّادٍ قَالاَ حَدَّثَنَا حَمَّادُ بْنُ سَلَمَةَ عَنْ دَاوُدَ بْنِ أَبِي هِنْدٍ عَنْ سَعِيدِ بْنِ الْمُسَيَّبِ عَنْ أَبِي هُرَيْرَةَ قَالَ

قَالَ رَسُولُ اللَّهِ ﷺ بِمِثْلِ حَدِيثِ يَحْيَى بْنِ مُحَمَّدٍ عَنِ الْعَلاَءِ ذَكَرَ فِيهِ وَإِنْ صَامَ وَصَلَّى وَزَعَمَ أَنَّهُ مُسْلِمٌ