QADIYA, Iraq — In the moments before he raped the 12-year-old girl, the Islamic State fighter took the time to explain that what he was about to do was not a sin. Because the preteen girl practiced a religion other than Islam, the Quran not only gave him the right to rape her — it condoned and encouraged it, he insisted.

He bound her hands and gagged her. Then he knelt beside the bed and prostrated himself in prayer before getting on top of her.

When it was over, he knelt to pray again, bookending the rape with acts of religious devotion.

“I kept telling him it hurts — please stop,” said the girl, whose body is so small an adult could circle her waist with two hands. “He told me that according to Islam he is allowed to rape an unbeliever. He said that by raping me, he is drawing closer to God,” she said in an interview alongside her family in a refugee camp here, to which she escaped after 11 months of captivity.

The systematic rape of women and girls from the Yazidi religious minority has become deeply enmeshed in the organization and the radical theology of the Islamic State in the year since the group announced it was reviving slavery as an institution. Interviews with 21 women and girls who recently escaped the Islamic State, as well as an examination of the group’s official communications, illuminate how the practice has been enshrined in the group’s core tenets.