All you need is an imagined enemy or threat (human or not) and a goal to impose on them. That's what happened with Hitler, Stalin and many more. Religion is just one of the many available excuses, and a popular one because there's already many religious people. Building on what people already believe is always the easiest way to get them to join.