MOSUL, Iraq — The young man ended up on the morgue’s examining table in two parts.

He had been seized for selling cigarettes, a crime usually punished by flogging by the Islamic State group extremists who had occupied Mosul. But while he was being whipped, he shouted a curse insulting religion. On the spot, they cut off his head for blasphemy.

Sameh al-Azzawi, the 35-year-old medical assistant examining him, was sick of seeing Mosul’s youth butchered for the slightest reason. The man was a newlywed. His family was waiting outside; it was one of the occasional times when the fanatics allowed the return of someone killed by the group. So al-Azzawi violated the rules: He picked out some thick thread and quickly sewed the man’s head back on, then zipped him up in the body bag. He could sew a head back on a body in four minutes.

The family quietly thanked him.

The morgue in the northern Iraqi city of Mosul was where atrocity met bureaucracy, the processing point for the machine of butchery that the Islamic State group created across its territory in Iraq and Syria. Every day, the doctors and staff witnessed the worst of what the militants were capable of inflicting on a human being, constantly fearing they could be next.

Yet the morgue men of Mosul found ways large and small to defy their captors by honoring the dead as best they could.

“Our profession as doctors is all about humanity,” said the morgue’s senior examiner, Modhar al-Omari. “They were doing the exact opposite.”

The staff sometimes faced up to 60 or even 100 corpses a day. As pickup trucks laden with bodies did three-point turns to back through the morgue’s gates, hands, legs or heads fell off onto the ground.

Some were the mangled bodies of civilians and IS fighters killed in bombardment by the U.S-led coalition or fighting with Iraqi troops. Others bore the marks of IS’ brutal enforcement of its radical version of Islamic law. A broken skull on a man with internal bleeding could mean he was thrown from a rooftop, the punishment for those suspected of being gay. A woman with a split skull from a blunt force was likely stoned to death, the sentence for accused adulterers. Then there were punishments for spying or blasphemy: a gunshot wound through the head or decapitation.

Convinced its “caliphate” was here to stay, the Islamic State group was keen on keeping records like a government. As they put together death certificates, the examiners quietly documented IS atrocities. They surreptitiously put an Arabic letter alif to mark a member of the group, and an M, the first letter in the Arabic word for “executed,” for the group’s victims.

One Excel sheet shows more than 1,200 people shot in the head, a likely sign of IS “executions,” between June 2014 when IS took over Mosul and January 2017, when Iraqi forces were fighting to take the city back — an average of 11 a week. The list has 12 women marked as “stoned to death.” It also lists 95 people who were beheaded and 50 men and boys who died from a “fall from a height,” likely hurled from rooftops.

The staff operated under close scrutiny by IS officials and threat of punishment if they broke the rules or tried to leave. Among those rules: The bodies of those “executed under religious law” could not be returned to their families, except in cases where an IS commander allowed it. Instead, they were dumped in mass graves. Thousands more went directly into mass graves without ever coming to the morgue ad IS brought at least 1,000 bodies to the morgue that they did not allow the staff to examine, so they have no idea who they were and did not record them.

Al-Azzawi managed to sew the heads back on about 10 bodies, he estimates. It had to be quick. He did it after midnight in the washing area, which IS fighters tended to stay out of because it was the worst smelling part of the morgue.

He stopped when one militant saw a body with the head restored. “We cut it and you put it back?” the fighter shouted. He warned that any examiner caught doing it would himself be beheaded.

“He’s still alive!”

A pickup truck dumped nearly a dozen bodies onto the pavement of the morgue courtyard, the latest delivery. “Get up!” an IS fighter screamed at the staff, summoning them to begin their daily task of sorting through the dead.

As the medical assistants went to work, one of them stopped short in surprise: Among the bodies, a young man in a soccer jersey and training pants who had been thrown off a rooftop was breathing.

“He’s still alive!” the assistant shouted instinctively.

He hardly had time to realize his mistake. The IS fighter opened fire with his automatic rifle, spraying the bodies. Bullets thumped into the already dead and finished off the young man.

“It’s a lot of pressure. Pressure, pressure, pressure,” said Raid Jassim, the chief medical assistant. “I always expected them to come at any moment and kill or behead us.”

In 2005, Jassim was overjoyed to get a government posting at Mosul’s Forensic Department, the morgue. The pay was several times more than what he’d earn in a government hospital. He was a graduate of a medical institute, a two-year diploma after high school, and had gone on to serve as an army nurse. At the morgue, he carried out examinations of bodies under supervision of doctors like al-Omari.

But no training prepared him for what he saw under the killers ruling his city.

A few months after IS took over, a militant brought in the body of a Yazidi woman, one of thousands from the religious minority group taken as sex slaves. She had hanged herself after being repeatedly gang-raped.

Jassim, 48, watched in horror and disgust as the militant spoke to the body. “Why did you kill yourself? I told you I am not selling you to the commander. I told you I was going to marry you,” the fighter pleaded.

One evening, fighters drove up with two men, alive, in the trunk of their car. They pulled them into the morgue courtyard and — in front of staffers too terrified to say a word — they shot one in the head and decapitated the other.

“This is a message to anyone who betrays the Caliphate,” one fighter yelled. The examiners suspected the two were IS members who had turned against the group. But they didn’t know why the fighters brought them to the morgue to kill. Was it a message for the staff somehow?

“In these occasions, we don’t open our mouths. We just stay silent,” Jassim said.

The morgue was located in the al-Shifaa medical complex, a large compound in the western half of Mosul that included the city’s main hospital, Jomhouriya, and other facilities. It was the primary medical facility for the militants, so fighters were brought from elsewhere in Iraq and even Syria for treatment. The office of the IS health minister was located there. That meant the staff was under the militants’ eyes all the time.

Jassim is a chain smoker and smoking was a crime. He hid his pack under his belt, covering up the smell with a spray of musk. Still, he was caught and punished with 30 lashes.

Another time he was severely beaten with a rifle butt in the office of IS’s deputy health minister, where he was taken after he refused a fighter’s demand that he forge a death certificate. Jassim’s two young sons, outside the office, heard their father’s screams.

But in a few cases, he and other staffers smuggled the dead to their families before they vanished into mass graves. They did it in secret, at night, cutting electricity to shut off the morgue’s security cameras as they hustled the bodies into their cars.

In one case, Jassim inspected the body of a woman who had been killed for allegedly feeding information to the Iraqi military.

In February 2016, she had posted on her Facebook page, “Snow is falling.” That seemed suspiciously like code to the Islamic State group, and she was arrested. The judge allowed her husband and children to meet with her for an hour before she was taken out to a public square and shot to death.

After that excruciating torment, the family should at least to be able to bury her, Jassim thought.

He met the businessmen at night in a parking garage, switching off the headlights of their cars off for fear of airstrikes. “You brought her?” the businessman asked. “Yes,” Jassim replied. The man broke into tears and hugged him in gratitude. Jassim then opened his car’s trunk so they could pull out his wife’s corpse.

Burying the trauma

Al-Azzawi recounts how tragedy after tragedy broke him down.

One day, he was going through the latest body bags when he saw a name he recognized pinned to a corpse. It was his cousin. The face was unrecognizable; he had been shot in the head for allegedly spying.

“I couldn’t believe it, I was reading the piece of paper over and over,” he said.

Months later, al-Azzawi tried to escape Mosul with a smuggler’s help. He and dozen others hid under boxes of potato chips in a truck but were caught near the Syrian border. He spent 10 days in detention, released only after he signed a pledge never to flee again on pain of death.

After that, “anything they ask for I do without complaint.”

One day after seeing 60 bodies, he went home and smashed his TV set.

Iraqi troops liberated western Mosul in the summer of 2017, and much of the medical complex where the morgue is located was bombed into ruins during the fighting that drove out the militants.

A stench now pervades the morgue from bodies that were in the refrigerators and are now buried in the rubble. The metal desks in the morgue offices have IS stickers on the drawers. Written on a wall is one of the slogans of the group, “Baqiya” — Arabic for “We will remain.” Next to it, someone has scrawled an insult, “Son of dog.”

Freed, the morgue men struggle with what they endured. Jassim can’t sleep without popping multiple valiums. His 13-year-old son — fearing for his father — won’t sleep apart from him. Some staffers have disappeared since liberation, simply not showing back up to work.

Al-Omari, the chief examiner, has been numbed by the helplessness he felt in the face of the fanatics’ dictates and butchery.

The 43-year-old veteran doctor and surgeon was well known among his staff for his calm. He was used to wearing suits, but under IS he was forced to wear the “Islamic” garb of shortened pants and a long beard that the group said was the style of the Prophet Muhammad.

The atrocities his staff was forced to contend with seemed endless: 16 boys under the age of 14 shot in the head. Six girls shot in the head. His job was to sign off on the cause of death for victims’ brutalized corpses. As a forensics doctor, he also had to investigate the “crimes” of the living — like signing medical examinations of whether women accused of adultery were virgins or not.

He got some revenge by passing on information. He secretly told the government in Baghdad when several senior commanders were killed in airstrikes.

But he says he has never cried for the dead.

“You can’t talk or explain. You just keep it inside,” he says. “If I cried, I’d cry every day for every single body.”