There is no doubt that religion had already waned under the onslaught of the Enlightenment but it was Freud who provided the radically new understanding of human nature that made any religious explanation of the whats and whys of our personhood seem naive.
One truth stands firm. All that happens in world history rests on something spiritual. If the spiritual is strong it creates world history. If it is weak it suffers world history.