Following is an interesting excerpt which has its own logic:
As regards the origin of God my own idea is that having realized the limitations of man, his weaknesses and shortcoming having been taken into consideration, God was brought into imaginary existence to encourage man to face boldly all the trying circumstances, to meet all dangers manfully and to check and restrain his outbursts in prosperity and affluence. God both with his private laws and parental generosity was imagined and painted in greater details. He was to serve as a deterrent factor when his fury and private laws were discussed so that man may not become a danger to society. He was to serve as a father, mother, sister and brother, friend and helpers when his parental qualifications were to be explained. So that when man be in great distress having been betrayed and deserted by all friends he may find consolation in the idea that an ever true friend was still there to help him, to support him and that He was almighty and could do anything. Really that was useful to the society in the primitive age.
The idea of God is helpful to man in distress.
Society has to fight out this belief as well as was fought the idol worship and the narrow conception of religion. Similarly, when man tries to stand on his own legs, and become a realist he shall have to throw the faith aside, and to face manfully all the distress, trouble, in which the circumstances may throw him. That is exactly my state of affairs. It is not my vanity, my friends. It is my mode of thinking that has made me an atheist. I don’t know whether in my case belief in God and offering of daily prayers which I consider to be most selfish and degraded act on the part of man, whether these prayers can prove to be helpful or they shall make my case worse still. I have read of atheists facing all troubles quite boldly, so am I trying to stand like a man with an erect head to the last; even on the gallows.
Let us see how I carry on : one friend asked me to pray. When informed of my atheism, he said, “During your last days you will begin to believe”. I said, No, dear Sir, it shall not be. I will think that to be an act of degradation and demoralization on my part. For selfish motives I am not going to pray. Readers and friends, “Is this vanity”? If it is, I stand for it. (Source: Why I am an atheist? – Wikisource.)
It is the ill-logic of existing religion which can reach to this conclusion only. But to know God, one has to divorce not only religion but himself as well.