Islamic State has set up departments to handle "war spoils," including slaves, and the exploitation of natural resources such as oil, creating the trappings of government that enable it to manage large swaths of Syria and Iraq and other areas.

The hierarchical bureaucracy, including petty rivalries between officials, and legal codes in the form of religious fatwas are detailed in a cache of documents seized by U.S. Special Operations Forces in a May raid in Syria that killed top ISIS financial official Abu Sayyaf. 

RELATED:  Ex-captive: Top ISIS commander is an American

U.S. officials say the documents have helped deepen their understanding of a militant group whose skill in controlling the territory it has seized has surprised many. They provide insight into how a once small insurgent group has developed a complex bureaucracy to manage revenue streams – from pillaged oil to stolen antiquities – and oversee subjugated populations.

"This really kind of brings it out. The level of bureaucratization, organization, the diwans, the committees," said Brett McGurk, President Obama's special envoy for the anti-ISIS coalition.

For example, one diwan, roughly equivalent to a government ministry, handles natural resources, including the exploitation of antiquities from ancient empires. Another processes "war spoils," including slaves.

RELATED: ISIS sanctioned organ harvesting in document taken in US raid

The documents also show how "meticulous and data-oriented" ISIS is in managing the oil and gas sector, although it is not a sophisticated operation, said Amos Hochstein, the State Department's top official for energy affairs.

U.S. officials said the documents have helped the anti-ISIS coalition to pinpoint vulnerabilities. The United States and its allies have been using air strikes to degrade the group's oil infrastructure and target key officials.

The documents show that ISIS is not immune to the rivalries and personality clashes that typify bureaucracies everywhere. A Nov. 21, 2014, letter from the Diwan of Natural Resources emphasizes that Abu Sayyaf is in charge of handling antiquities.

"The reason being is that he is very knowledgeable in this field and that Abu Jihad al-Tunisi is a simpleton who can't manage the division," it says.

RELATED:  Anonymous to ISIS: 'War is declared, get prepared'

Many of the seized documents are fatwas, or religious rulings, covering issues from rape of female prisoners and the treatment of slaves with minor children to when it is permissible for a son to steal from his father to fund travel to fight jihad, or holy war.

Citing sayings of the Prophet Mohammad, the documents call for both kindness and cruelty to captives by ISIS fighters. Enslaved women should not be separated from their children, but elsewhere the rules allow ISIS fighters to have sex with female slaves.

The rules not only apply to captured territory in Iraq and Syria but also its self-declared provinces in Africa, the Sinai and South Asia. They cover even mundane issues.

In the documents, there is a ruling on proper procedure for filling out the personal details of prospective fighters: name, gender, and communications method – telephone, telegram, Skype or the mobile messaging service WhatsApp.