It seems that although Darwin did not believe in God, but he kept it to himself and avoided public controversy.In the origin of species he did not directly stated that he is an atheist despite of the materials in the book, which was against Bible and Church of England beliefs. In his autobiography that was written in 1876 he mentions that when he was writing Origin of Species he still believed in existence of God. He says
"The extreme difficulty or rather impossibility of conceiving this immense and wonderful universe, including man with his capacity of looking far backwards and far into futurity, as the result of blind chance or necessity. When thus reflecting I feel compelled to look to a First Cause having an intelligent mind in some degree analogous to that of man; and I deserve to be called a Theist."
Also, in his letter to Asa Gray, an American Presbyterian who was cooperating with Darwin and discussing the relations between natural theology and natural selection, Darwin mentioned that he still cannot reject God as the first cause. The following is a letter Darwin sent to Asa Gray about his religious beliefs:
"With respect to the theological view of the question; this is always painful to me.— I am bewildered.– I had no intention to write atheistically. But I own that I cannot see, as plainly as others do, & as I [should] wish to do, evidence of design & beneficence on all sides of us. There seems to me too much misery in the world. I see no necessity in the belief that the eye was expressly designed. On the other hand I cannot anyhow be contented to view this wonderful universe & especially the nature of man, & to conclude that everything is the result of brute force. I am inclined to look at everything as resulting from designed laws, with the details, whether good or bad, left to the working out of what we may call chance. Not that this notion at all satisfies me. I feel most deeply that the whole subject is too profound for the human intellect. A dog might as well speculate on the mind of Newton.— Let each man hope & believe what he can." Therefore, during accumulating his thoughts during Origin of Species, Darwin was still in doubt about existence of God and his tendency to Christianity.