Sri Ramakrishna used to say that if a man frequents a wine shop and still has his mind fixed on God, he is a superior devotee to one who puts on external marks of religion, but whose mind is deeply attracted to worldly enjoyments. He illustrated this idea through the following parable.
A short story
Once two friends happened to meet in a street in the locality where they lived. It was evening time. While they were walking together, they saw that a discourse on Bhagavata was going on nearby and several people were listening to the reading of the scripture. One of the friends earnestly invited the other saying that it would be wonderful if they could listen to the discourse together. Saying so, he went in and sat down. However, the other person just peeped in and went away. After some time he entered the house of an ill-fame, but very soon he felt disgusted with himself and was overcome with remorse. He felt ashamed of his behavior. He thought that his friend had been listening to the sacred scripture which extols the glories of Hari, whereas he himself had chosen a wretched path. But the friend who had been listening to the Bhagavata also became disgusted with himself. He felt that he had been a fool and instead of having a good time like his friend, he had been listening to some useless discourse. In the course of time, both of them died. The messenger of death came to fetch the soul of one who had gone to listen to the Bhagavata and took it to hell. The messenger of Lord Vishnu came to fetch the soul of one who had visited the house of ill-fame and led it to heaven.
Sri Ramakrishna used to say that God judges a man by looking into his heart and not by his mere external actions.