Religion as such is advantageous for human kind. People became religious in the progress of evolution. Although it is believed that it is religion that teaches us what's right and what's wrong, I think religion evolved to substantiate our morality. Brain likes to validate our beheviors.
Olga Woźniak: Stań się dobrym. To się opłaca (interview), „Gazeta Wyborcza, December 24, 2011.