Yes, but the reason they believed religion needed to be eradicated was not so much because they were atheists as that it was competition for the loyalties of the people they ruled over.
This can be said for "religious" wars. Do you know any war where the rulers reason for participation was really religion and not power gain? However claiming religious reasons has often helped getting support by the people. But this also worked for Stalin and Mao, see e.g.: http://en.wikipedia.org/wiki/League_of_Militant_Atheists
Also I think the power gain theory is not strictly true. When Nazi Germany invaded the Soviet Union in 1941 Stalin shut down the League of millitant godless, anti-religious periodicals and reopened churches to gain more support by the people. So for power gain the extremely antireligious activities were actually counterproductive and Stalin apparently knew this and continued until he felt he needed the support of religious people to not lose the war against Nazi-Germany.
For Hitler power gain as motivation behind his antichurch activities sounds more like likely. He used antireligious persecution against religious entities which he could not control, changed the protestant church to the "German Christians" and tried to appear as regular Christian in public while his private opinions were different.