As Islamic State fighters executed at least 60 people at a remote military base in northern Iraq one day last year, he cowered in his home nearby, terrified. When it was safe to go out, he found piles of bodies; many of them he recognized as his neighbors. He buried them himself.

"They were slaughtering people for all kinds of reasons, those caught using the internet, those suspected of being witches," the shepherd, Saad al-Omar, said at the site of a mass grave here on Tuesday. "Here, I saw those victims, my neighbors. I saw bodies of mothers with their children. They had been shot. They had been burned. They were all dead."

That executions routinely took place in his hometown, Hawija, was well known, proudly publicized by the Islamic State, also known as ISIS, during its two-and-a-half year rule in the town. But Mr. Omar's grisly knowledge represents something rare in the quest for justice -- a witness who can lead the authorities to the bodies and identify many of them.

As Iraqi officials declared Friday that they had taken the last Iraqi town held by the Islamic State, reducing the group's self-declared caliphate to a tiny remnant on the Syrian side of the border, they are still trying to comprehend the scale of the group's horrors.

So far, they have found the sites of more than 70 mass graves, numbers that have overwhelmed the nation's police and forensics resources as well as the Iraqis' international partners helping to search for tens of thousands of missing people.

In September, the United Nations Security Council empowered a special adviser to help Iraq investigate potential war crimes, including mass killings, committed by Islamic State. The adviser's team will not arrive in Iraq until early 2018. Given the limited resources and costs of forensics, it is unclear how many mass graves could be properly exhumed, let alone how many -- if any -- suspects could face justice.

In Hawija, a small town in a flat, arid valley in southwestern Kirkuk Province, the head of civil defense, Col. Brahim Attiyah al-Jabbouri, said he fielded numerous, frantic requests each day from families searching for news of loved ones.

For him, the quest for answers is deeply personal.

Two of his cousins were detained by local Islamic State operatives and never seen again. One, a 45-year-old father of six, Nawaf al-Abdullah, had worked as an interpreter for American troops at the United States military base in Hawija. The Islamic State used the abandoned base, Forward Operating Base McHenry, as its execution site.

"Can you imagine a crueler fate?" asked Colonel Jabbouri. "To be murdered by your enemy at the place" where you once worked.

The United States established the base in 2003 to train local residents to fight against the Al Qaeda-led insurgency. American country music stars held concerts in Hawija to build morale.

By the time American forces withdrew in 2011, the jihadi organization was in tatters and Iraqis took over the Hawija compound.

In 2014, the Islamic State juggernaut swept across the dusty valley, overwhelming Hawija, the base and the surrounding farming villages.

Today, the gravel-and-sand terrain of the former base resembles a gruesome obstacle course, its pathways littered with human femurs and jawbones laced with broken teeth.

Among the Islamic State's first targets were men who had worked in local law enforcement or with the Americans. Mr. Abdullah had done both. His younger brother, Watban, 21, had worked for the police. So the entire Abdullah family came under suspicion, according to Mr. Abdullah's sister, Saida, who spoke by phone from a camp for internally displaced Iraqis about 70 miles east of Hawija.

That included Mr. Abdullah, his wife and six children, as well as Watban, a newlywed whose wife had recently given birth to a girl.

For more than a year, their families tried to keep a low profile, as it was deemed too dangerous for the brothers to try to escape by slipping through the Islamic State's well-manned checkpoints. "We were far away from anyplace safe," Saida al-Abdullah said. "We had no escape."

By late 2015, the Islamic State had made executions a routine event, according to the group's own propaganda videos. They were using the former base for their charnel house, in part because it offered a well-protected and remote space that would have hindered escape and prevented others from witnessing the activities there, Colonel Jabbouri said.

In January 2016, a group of Islamic State fighters drove into town, arrested Watban al-Abdullah and accused him of trying to sneak out of town, his sister said.

He disappeared in their custody, and the family had no way of knowing what had become of him.

Mr. Omar did. The 25-year-old shepherd lived on the outskirts of Hawija, near the former military base.

In February 2016, a couple of days after Watban al-Abdullah's arrest, Mr. Omar and his family heard the gunshots and screams emanating from inside the base.

Later that night, when the area appeared deserted, Mr. Omar climbed the earthen walls to see what had happened.

The scene surpassed his worst nightmares. Dozens of bodies, some clothed and some burned, lay scattered across the frigid ground in large sticky pools of blood. "The stench was unbearable," Mr. Omar recalled, his weathered face pulled into a grimace. "You can't imagine the feeling of seeing the bodies of children, of people that my family and I knew."

Mr. Omar felt outrage about the killings, as well as the indignity of the unburied bodies' likely desecration by wild dogs. He shook off his fear of being discovered by Islamic State and tried to do the decent thing for the victims.

By starlight, for several nights in a row, he dug several shallow pits and pulled, by his count, 60 bodies into a makeshift grave, including the body of Watban al-Abdullah, whom he recognized.

"Some of the bodies were burned," Mr. Omar said. "Some had been tortured. But I knew him."

Mr. Omar got word to the Abdullah family about what he had seen. The Islamic State, however, never confirmed what happened, Mr. Abdullah's wife and sister said.

His wife Naeema said that the last time she saw her husband was Feb. 10, 2016. She presumes that the Islamic State caught him. She has not heard from him since he left.

The next time that Islamic State fighters entered the base, it was clear that someone had trespassed.

They began a search for the culprit, and immediately went to Mr. Omar's family farm, the closest homestead to the base.

The Omars denied any knowledge of the burials, but the family knew Mr. Omar was no longer safe. He went into hiding. By April 2016, he and his family fled Hawija for good.

"I had to run away," he said. "I knew my fate would have been the same as theirs if I stayed."

Mr. Omar carried his secret with him, until last month, when Iraqi forces liberated Hawija. He returned soon after and tracked down Colonel Jabbouri to tell him what he knew.

After fierce fighting to retake the town, about 60 local Islamic State members are believed to be at large, said the regional head of intelligence, Capt. Maath al-Obeidi. One of them is the man suspected of ordering executions in Hawija, a local Iraqi named Abdel Nasser Ghazi al-Mousa, Captain Obeidi said.

"We are working to hunt him down," he said.

More than a month after its liberation, Hawija remains a ghost town. Whole neighborhoods have been reduced to rubble, the commercial district torn apart by artillery fire. Most residents are waiting for local services to be restored before they leave their humanitarian aid camps and return.

Colonel Jabbouri said that although he was desperate for answers about what happened, he did not have the equipment or personnel needed for a thorough exhumation.

"I have dozens of people calling and writing to me on Facebook," he said, standing at the grave site. "Everyone wants answers. We are frantic. But without experts, there is no way to really know who is here."