Editor’s Note: Peter Bergen is CNN’s national security analyst, a vice president at the New America Foundation and the author of “Manhunt: The Ten-Year Search for bin Laden – From 9/11 to Abbottabad.

Story highlights

The group's atrocities have angered Americans, Jordanians and Egyptians

Bergen: ISIS actions only make sense if you realize that its aim is the apocalypse.

CNN  — 

Whenever ISIS carries out a new atrocity, whether it’s beheading a group of Egyptian Christians or enslaving Yazidi women in Iraq or burning its victims alive, the big question most people have is: Why on Earth is ISIS doing this? What could possibly be the point?

Adding to your list of enemies is never a sound strategy, yet ISIS’ ferocious campaign against the Shia, Kurds, Yazidis, Christians, and Muslims who don’t precisely share its views has united every ethnic and religious group in Syria and Iraq against them.

Peter Bergen

ISIS is even at war with its most natural ally, al Qaeda in Syria.

The Nazis and the Khmer Rouge went to great lengths to hide their crimes against humanity. Instead, ISIS posts its many crimes on social media for global distribution with seemingly no thoughts for the consequences.

ISIS’ beheading of the American journalist James Foley in mid-August galvanized much of the Western world against the group and led to an intensified U.S.-led air campaign against ISIS, which, according to U.S. military officials, has killed at least 6,000 of its fighters.

The burning to death by ISIS of the Jordanian pilot, Muath al-Kaseasbeh, galvanized much of the Arab world against the group and has brought Jordan into the U.S.-led campaign against ISIS in a much more aggressive manner.

The beheading of 21 Egyptian Coptic Christians in Libya by an ISIS affiliate led Egypt’s air force on Monday to drop bombs on ISIS positions in eastern Libya.

Former CIA director Robert Gates is reported to have kept a maxim on his desk that read, “As a general rule, the way to achieve complete strategic surprise is to commit an act that makes no sense or is even self-destructive.”

ISIS keeps surprising the world and its actions do indeed seem to make no sense or are self-destructive.

So what is going on here?

A key window into understanding ISIS is its English language “in-flight magazine” Dabiq. Last week the seventh issue of Dabiq was released, and a close reading of it helps explains ISIS’ world view.

The mistake some make when viewing ISIS is to see it as a rational actor. Instead, as the magazine documents, its ideology is that of an apocalyptic cult that believes that we are living in the end times and that ISIS’ actions are hastening the moment when this will happen.

The name of the Dabiq magazine itself helps us understand ISIS’ worldview. The Syrian town of Dabiq is where the Prophet Mohammed is supposed to have predicted that the armies of Islam and “Rome” would meet for the final battle that will precede the end of time and the triumph of true Islam.

In the recent issue of Dabiq it states: “As the world progresses towards al-Malhamah al-Kubrā, (‘the Great Battle’ to be held at Dabiq) the option to stand on the sidelines as a mere observer is being lost.” In other words, in its logic, you are either on the side of ISIS or you are on the side of the Crusaders and infidels.

When American aid worker Peter Kassig was murdered by ISIS in November, “Jihadi John” – the masked British murderer who has appeared in so many ISIS videos – said of Kassig: “We bury the first crusader in Dabiq, eagerly waiting for the rest of your armies to arrive.”

In other words, ISIS wants a Western ground force to invade Syria, as that will confirm the prophecy about Dabiq.

We live in an increasingly secularized world, so it’s sometimes difficult to take seriously the deeply held religious beliefs of others. For many of us the idea that the end of times will come with a battle between “Rome” and Islam at the obscure Syrian town of Dabiq is as absurd as the belief that the Mayans had that their human sacrifices could influence future events.

But for ISIS, the Dabiq prophecy is deadly serious. Members of ISIS believe that they are the vanguard fighting a religious war, which Allah has determined will be won by the forces of true Islam.

This is the conclusion of an important forthcoming new book about ISIS by terrorism experts J.M. Berger and Jessica Stern who write that ISIS, like many other “violent apocalyptic groups, tend to see themselves as participating in a cosmic war between good and evil, in which moral rules do not apply.”

This also similar to the conclusion of an excellent new cover story about ISIS in the Atlantic magazine by Graeme Wood who writes, “Virtually every major decision and law promulgated by the Islamic State (another name for ISIS) adheres to what it calls, in its press and pronouncements, and on its billboards, license plates, stationery, and coins, ‘the Prophetic methodology,’ which means following the prophecy and example of Muhammad, in punctilious detail. Muslims can reject the Islamic State; nearly all do. But pretending that it isn’t actually a religious, millenarian group, with theology that must be understood to be combated, has already led the United States to underestimate it.” Amen to that.

ISIS members devoutly believe that they are fighting in a cosmic war in which they are on the side of good, which allows them to kill anyone they perceive to be standing in their way with no compunction. This is, of course, a serious delusion, but serious it is.

Read CNNOpinion’s new Flipboard magazine.

Follow us on Twitter @CNNOpinion.

Join us on Facebook.com/CNNOpinion.