The Terrans never really moved beyond the need for religion and belief in a higher power. That higher power just became the Federation. After all, what was the Prime Directive if not a holy precept? Notably, even in Kirk's day the Federation wasn't an atheist state (and was notably far less...