The Messenger of Allah ﷺ said, "A man may appear to people to be doing the deeds of the people of Paradise, while in truth he is among the people of the Fire. And a man may appear to people to be doing the deeds of the people of the Fire, while in truth he is among the people of Paradise."
أن رسول الله ﷺ قال: إن الرجل ليعمل عمل أهل الجنة، فيما يبدو للناس وهو من أهل النار، وإن الرجل ليعمل عمل أهل النار فيما يبدو للناس، وهو من أهل الجنة.
Bukhari narrated it in Jihad and Expeditions (2898), and Muslim in Divine Decree (12), in this abridged form, both from Qutayba bin Saeed, who said, Yaqub bin Abdul-Rahman Qari narrated to us, from Abu Hazim, from Sahl bin Saad, and he mentioned it.Muslim narrated it in Faith (112) in full detail, and it is from Sahl bin Saad Saadi, that the Messenger of Allah ﷺ met the polytheists and they fought. When the Messenger of Allah ﷺ turned back toward his camp and the others turned back toward their camp, among the companions of the Messenger of Allah ﷺ was a man who would not let any straggler go without pursuing him and striking him with his sword. So they said, "None of us has done as well today as so-and-so." The Messenger of Allah ﷺ said, "He is one of the people of the Fire." A man among the people said, "I will keep watch over him." He said, so he went out with him, whenever he stopped he stopped with him, and whenever he hurried he hurried with him.He said, then the man was wounded severely, and wishing to hasten death, he placed the blade of his sword on the ground and its tip between his breasts, then pressed down on his sword and killed himself. The man then went to the Messenger of Allah ﷺ and said, "I bear witness that you are the Messenger of Allah." He said, "What is that for?" He said, "The man you mentioned earlier as being one of the people of the Fire, the people found that hard to accept, so I said, I will find out for you. I went out in search of him until he was severely wounded, and wishing to hasten death, he placed the blade of his sword on the ground and its tip between his breasts, then pressed down on it and killed himself."At that, the Messenger of Allah ﷺ said, "A man may do the deeds of the people of Paradise as it appears to the people, while he is in fact one of the people of the Fire, and a man may do the deeds of the people of the Fire as it appears to the people, while he is in fact one of the people of Paradise."And in Bukhari, in Divine Decree (6607), from another route through Abu Hazim, "Indeed deeds are judged by their endings."