The Islamic State terror group was manufacturing weapons in and around Mosul on an industrial scale with products largely bought in bulk from Turkey, according to a report published by an arms research group Wednesday.

The findings showed that ISIS maintained a "robust and reliable" supply chain between Turkey and Iraq that allowed the fighters to produce tens of thousands of weapons, the London-based Conflict Armament Research said. The group's researchers studied ISIS weapons found at manufacturing facilities and on the battlefield during the Iraqi operation to retake Mosul that is underway.

As Iraqi forces advance, the extremists are losing the physical capacity to manufacture weapons on an industrial scale, but the research group's executive director James Bevan warned that highly trained fighters will take their expertise with them as they retreat.

"Given that this group is so organized, they clearly see the writing on the wall in Mosul," Bevan told The Associated Press, saying he believes ISIS has already moved its highest trained bomb-makers out of Mosul and into Syria and southern Turkey.

"They place a very high value on technical capacity and they will do everything they can to preserve it," he said. Bevan added that ISIS fighters likely looked to Turkey to purchase weapons ingredients, knowing that their demand would outstrip what is available in Iraq.

Iraqi forces have been met with stiff resistance in Mosul, including waves of suicide car bombs, since launching an offensive to retake the city in October. They have retaken less than a quarter of the city since the operation began.

For many among Mosul's Sunni Arabs, rule by the Sunni militants of ISIS initially seemed a respite from what they considered the heavy hand of Iraq's Shiite-led central government in Baghdad. As Iraqi soldiers vanished in those first few weeks, people were simply happy to see hated security checkpoints pulled down and traffic moving smoothly along streets lined with low, pale buildings. Sunni insurgents have long been active in Mosul, and Baghdad's clampdowns against them usually only fueled residents' distrust.

But even as families strolled in the parks and shops stayed open, signs emerged that this group of fighters was unlike past insurgents who had worked strictly underground. They were staying put: Trucks began hauling office furniture to various government buildings, according to a blog called "Mosul Eye," written by a resident who took on the role of city historian.

Several weeks later, the group declared its "caliphate" stretching across its territory in Syria and Iraq.

Within a month, the homes of Christians and other minorities were tagged with official stickers -- for "statistical purposes," ISIS officials said, according to Mosul Eye. Christians and Shiites soon fled, leaving their marked homes and belongings behind.

Kurds were soon targeted as well. "If you turned in a Kurdish family, they gave you a car," said Hassan Ali Mustapha, a retired prison guard. He said he moved into a home deserted by a Kurdish family, after the family asked him through a mutual friend to do so to keep Islamic State from taking it over.

Mustapha walked with a heavy limp through the camp that is his family's new home. They made their escape from Mosul first on foot and then by Iraqi government truck.

The group imposed the extreme, severe vision of Islamic law across its zone of control. Dress was strictly regulated, and clothes manufacturers were told to report to Islamic State offices to receive the acceptable measurements. Women were required to hide their faces and don black down to their fingertips. The fine for violations -- even as small as the wrong kind of stocking -- was 25,000 dinars, around 20 dollars. Repeat offenders got lashes.

There was another, widely feared punishment as well: The women's brigade of religious enforcers used a metal-toothed device to deliver vicious, deep "bites" on women they deemed as dressing improperly, according to two women.

Punishments were often public, and in a central square the group printed broadsheets proclaiming how it would respond to disobedience. In one case, according to a witness, there was a gleeful description of "criminals" being shoved into a commercial oven to roast to death.

The militants took a cut of all business through fees, fines or taxes. Even roadside hawkers had to pay ISIS according to the size of the sheet on the ground where they displayed their wares -- $12 per square meter. As they described indignities piling up, the camp residents dragged their feet in the dust to show just how small a space could be taxed.

Residents learned to keep a mental tally of all the different rules -- and find ways to dissent.

The most symbolic was the widespread refusal to send children to the schools, which the extremists took over.

Mosul prides itself on an ancient history of knowledge. Near the center of the city are the ruins of the city of Nineveh where stone tablets more than 3,000 years old were discovered in a library, inscribed with the Mesopotamian epic of Gilgamesh, considered humanity's oldest surviving work of literature.

But in the ISIS schools, lessons were about guns and warplanes. Mathematics courses couldn't use a plus symbol because it resembled a Christian cross. Mosul's biggest libraries were ransacked over a number of weeks, beginning in late 2014, and the extremists set up bonfires to torch books on science and culture, according to accounts at the time.

The Associated Press contributed to this report.