While ISIS appears to be run by religious fanaticism, it instead has been functioning more like a secret intelligence service, calculating every operation and drafting plans of a covert Syrian takeover for years, files seen by Der Spiegel have revealed.

The German magazine is citing secret papers of the strategic head of ISIS, who was killed in a firefight in 2014, but who left behind information regarding a trove of blueprints for ISIS intelligence services’ structure and plans of a takeover of large parts of Syrian territory.

Page-by-page the documents reveal a sophisticated plan, not so much for jihad, but for building a caliphate run by cold calculations.

Eliminated #ISIS commander Haji Bakr left behind secret files which detail structure and tactics for the first time. pic.twitter.com/WLfz7uCInT — Julie Lenarz (@MsIntervention) April 18, 2015

The organizational charts and chains of command drawn by the top strategist reveal a clearly-defined Secret Service structure with surveillance and security departments, prison and interrogation divisions, weapons and technology experts, as well as sharia judges and instructors.

The records, Spiegel reports, contain details of ISIS espionage operations and other intelligence activities to covertly gain power in territories of their interest and make sure no dissent would be possible after an actual armed takeover.

The documents explain how men would initially be recruited by ISIS in target towns and villages via local cells disguised as Islamic missionary centers. The recruits then would report back to ISIS leadership with information on the powerful locals as well as what their sources of income were, people’s political orientation and any other information which could be used to blackmail them later.

“We will appoint the smartest ones as Sharia sheiks... We will train them for a while and then dispatch them,” the ISIS mastermind Haji Bakr, whose real name was Samir Abd Muhammad al-Khlifawi, had noted in one of the papers. “Brothers” would be selected in each town to marry the daughters of the most influential families, in order to "ensure penetration of these families without their knowledge.”

The Islamic State leadership gathered any information useful for dividing and subjugating the local population. As far as Syria was concerned, they used whoever they could and changed allegiances whenever they felt like it, with their informants including former intelligence spies as well as opponents of the regime.

Another phase of the plan included the elimination of any powerful people and potential leaders who could organize the local population against the infiltrators. But in towns where the resistance grown too strong, the publication writes, ISIS temporarily withdrew allowing local Syrian rebels confront the government forces.

The reason why ISIS are so successful as a terrorist organization is partly because many of their founding members, including the top strategist, were part of Saddam Hussein’s professional security apparatus. By shattering the well-trained army of Saddam, the US apparently created an group of very intelligent enemies.

READ MORE: ISIS leader says US prisons in Iraq led to creation of terrorist organization

Bakr was a “highly intelligent, firm and an excellent logistician,” as an Iraqi journalist described the former officer. But when the US suddenly dissolved the Iraqi army after the 2003 invasion he became “bitter and unemployed.”

Being a “nationalist” rather than an Islamist, Bakr together with other former Iraqi intelligence officers gave the organization a “religious face” in 2010, the publication claims. The group appointed an educated cleric Abu Bakr al-Baghdadi as their leader and future caliph.

The terrorist organization apparently realized most of their plans, and by late 2012 things in Syria were a mess with Pesident Assad’s pushed back while hundreds of local councils and rebel brigades took control of the territory. This anarchic mix was exploited by this tightly-organized group of ex-officers to create the terrorist caliphate that straddles much of Syria and Iraq today.