Stanislaw Lem was raised as a Catholic and, in fact, was a close friend of the man who would become Pope John Paul II. Lem came to identify himself as an atheist, saying he did so for "moral reasons."
From: "Stanislaw Lem" page on "Celebrity Atheists" website, last modified 19 Jun 2005 (http://www.celebatheists.com/wiki/index.php?title=Stanislaw_Lem; viewed 24 August 2005):
Trained to be a physician, and "brought up with the scientific outlook" by his father who was also a physician, he subsequently "spent many hours over coffee arguing about God" with his friend Karol Wojtyla who taught theology in Cracow and who is now better known as Pope John-Paul II. In an interview, Lem indicated his thinking on religion: "for moral reasons I am an atheist -- for moral reasons. I am of the opinion that you would recognize a creator by his creation, and the world appears to me to be put together in such a painful way that I prefer to believe that it was not created by anyone than to think that somebody created this intentionally" (L. W. Michaelson, "A Conversation with Stanislaw Lem": Amazing (Jan. 1981): 116-19. Peter Engel, "An Interview With Stanislaw Lem": The Missouri Review, 7, 2 (1984): 218-37. Also see Raymond Federman, "An Interview with Stanislaw Lem," Science-Fiction Studies, 10 (1983): 2-14).