To view the destruction of ancient sites and artefacts as the irrational acts of a death cult is to miss the point. Like its policies of genocide and enslavement, this is driven by clear goals and religious justifications.

Since June 2014, the world's focus has been drawn by the ability of ISIS to inspire shock and revulsion, even amid campaigns to push it out of the territory that it has claimed in Iraq and Syria. In recent months, however, it is not only massacres, brutal murders, or mass kidnappings that have drawn attention, but wanton destruction of the pre-Islamic patrimony of the two countries.

In March 2015, reports that ISIS bulldozers had started razing the ancient Assyrian capital of Nimrud, a UNESCO world heritage site founded in the 13th century BC, led headlines around the world. Irina Bokova, the head of UNESCO, described the group's actions as a war crime, and examples of "cultural cleansing." Since then, the group has wrought similar destruction on the ancient city of Ninevah and numerous ancient shrine. News of the group's advance on the Syrian city of Palmyra in May 2015 raised fears that it would suffer a similar fate. Initially, upon seizing the city, ISIS' atrocities were focused on local inhabitants and pro-regime fighters; indeed, the group has made use of the city's Roman amphitheatre for mass public executions. But reports at the start of July showed the group starting to destroy artefacts there as well.

A video emerged in late February 2014 showing ISIS militants pulverising ancient artefacts in a Mosul museum. In the video, the Gulf-accented narrator gives a clear reason for the group's actions. "The remains that you see behind me are the idols of peoples of previous centuries, which were worshipped instead of Allah... The Prophet Muhammad shattered the idols with his own hands, when he conquered Mecca... This is what his companions did later when they conquered lands. Since Allah commanded us to shatter and destroy these statues, idols and remains, it is easy for us to obey."

This reasoning is central to why actions like this are not surprising. They go to the heart of the Salafi project: to return Islam to their perception of its condition at the time of Muhammad and his companions, and overturn bid'a (innovation) that has corrupted the religion since. It is now a commonplace to say that ISIS is simply a death cult. But this is to ignore the central role that justifications like these play in the group's actions – and it ignores that ideological milieu from which ISIS and its fellow travellers are drawn.

The Salafi current is driven by a fervent desire to eliminate shirk.

This Salafi current is driven by a fervent desire to eliminate shirk: the association of others with God. This is mirrored by a desire to restore pure tawhid, belief in the one-ness of God. Within the majority of the Salafi movement, it is manifested by the fastidious imitation of the practices of the Prophet and his companions as far as is possible (from style of facial hair to methods of brushing one's teeth) and extensive proselytisation, both outside Islam to bring people to the faith, and within it to restore tawhid and destroy bid'a.

However, when this literalist current is translated to Salafi-jihadi movements its consequences are more dangerous. The genocide of the Yezidi was justified in terms of defeating shirk and restoring tawhid. Massacres of Shia, regarded by many Salafis as mushrikun (those who practice shirk) for their veneration of the family of the Prophet, is justified in terms of eliminating shirk and returning to tawhid. Persecutions (and killings) of Sunni have been justified in the same way: the destruction of the shrine of the prophet Jonah in Mosul in July 2014 or the destruction of the shrine of Imam Nawawi in Syria in January 2015 were justified on the grounds that they encouraged shirk. Nor is such action limited to the Syrian and Iraqi theatres. When jihadi rebels took Timbuktu in 2012, they destroyed mosques and shrines. When Islamic sites are destroyed so readily by jihadi groups on the grounds that they encourage shirk, pre-Islamic heritage is especially vulnerable – shown when the Taliban blew up the Bamiyan Buddhas in 2001.

But the references of the vandals in Mosul to the actions of the Prophet and his companions is notable in how disingenuous it is. While it is true that Muhammad ordered the destruction of the pagan idols in the Ka'aba (the focal point of Muslim prayer), the mere modern-day existence of such extensive pre-Islamic heritage across most of the Muslim world reveals the lie that ISIS is emulating the practice of his companions when they conquered other lands, from Egypt to Syria and across the Islamic world. Perhaps sensing the difficulty, the video of the destruction in the Mosul museum ends with a clarificatory footnote: "These idols and statues were not visible in the days of the Prophet Muhammad and his companions, but were extracted by the worshippers of the devils."

When we focus on individual actions of groups like ISIS, however, brutal or destructive, they inevitably appall. But to treat the group as a psychopathic aberration, acting irrationally and devoted only to destruction is to miss the logic that underpins its actions. There is a clear narrative of violent literalism in understanding scripture that runs through all of its actions: its brutality is not random or irrational, but designed to achieve something. Until we understand this, we may defeat ISIS, but we won't defeat the undercurrent from which it springs.