The Prophet ﷺ said, and Ahmad in his version said that the Messenger of Allah ﷺ said, "The fornicator is not a believer at the moment he commits fornication, the thief is not a believer at the moment he steals, and the drinker of wine is not a believer at the moment he drinks it. Yet Tawba remains open afterward."
أخبرنا محمد بن المثنى قال حدثنا ابن أبي عدي عن شعبة عن سليمان ح وأنبأنا أحمد بن سيار قال حدثنا عبد الله بن عثمان عن أبي حمزة عن الأعمش عن أبي صالح
عن النبي ﷺ وقال أحمد في حديثه قال قال رسول الله ﷺ لا يزني الزاني حين يزني وهو مؤمن ولا يسرق حين يسرق وهو مؤمن ولا يشرب الخمر حين يشرب وهو مؤمن ثم التوبة معروضة بعد
Citation. Narrated by Muslim, Book of Faith, chapter on the explanation that faith decreases through sins... etc., hadith no. 104/57, from Muhammad bin Muthanna. And by Bukhari, Book of Legal Punishments, chapter on the sin of fornicators and the saying of Allah Almighty, "and do not commit zina" [Furqan 25:68]... etc., hadith no. 6810, from the hadith of Shubah with the same wording. It is also found in Sunan al-Kubra, hadith nos. 7356, 7355.