The Islamic State has its theological foundation in Wahabism, a branch of Islam invented in the 18th century in the Arabian peninsula, and adopted by the Saud family as their official creed, as they build Saudi Arabia. They were helped by the West in order to weaken the Ottoman Empire.
This religious reform simply wanted, at the begining, to clean up some saint-worshiping (mainly imploding their tumbs) that had been introducing in Islam. And the cry for this reform was “let us stick strictly to the letter of what Coram says. No interpretation allowed”.
Does it sounds familiar? Yes: this is Calvinism, the 16th century reformation of Luther, the reformer, and the “sola scriptura” principle
The problem is that the Coram has the external form of a civil and penal code. Thus, if you stick to the letter, you are time-traveled back to the 7th century, and your society turns grotesque.
We should better be careful with what we believe.