"No one who commits Zina is a believer at the moment when he is committing Zina; no one who steals is a believer at the moment when he is stealing; no one who drinks wine is a believer at the moment when he is drinking it." - And he mentioned a fourth but I (the narrator) have forgotten it - "When he does that the yoke of Islam is shed from his neck, but if he repents, Allah accepts his repentance."
لاَ يَزْنِي الزَّانِي حِينَ يَزْنِي وَهُوَ مُؤْمِنٌ وَلاَ يَسْرِقُ وَهُوَ مُؤْمِنٌ وَلاَ يَشْرَبُ الْخَمْرَ وَهُوَ مُؤْمِنٌ وَذَكَرَ رَابِعَةً فَنَسِيتُهَا فَإِذَا فَعَلَ ذَلِكَ خَلَعَ رِبْقَةَ الإِسْلاَمِ مِنْ عُنُقِهِ فَإِنْ تَابَ تَابَ اللَّهُ عَلَيْهِ