Armed guards led the Islamic State suspect down the terrazzo hall and into an office where two judges sat behind carved wooden desks.
They wore heavy black overcoats, the building's heat having failed long ago.
"When did you swear your affiliation?" barked one of the judges, a tall, clean-shaven man, imposing even when seated.
The suspect, a calm young man with a trimmed beard who had been detained at a police checkpoint, denied having sworn allegiance to the militant group.
"I will stay here until tonight questioning you until you tell me," the judge said.
"I didn't deal with Islamic State," the man insisted.
More than two months into an offensive to retake the city of Mosul from Islamic State, scores of suspected militants have been sent by Iraqi counterterrorism forces to a series of terrorist investigation courts set up as an alternative to instant justice.
"It's crucial to the future of Iraq as a state," Professor Audrey Kurth Cronin at American University's School of International Service said of the hearings, which she said could "reestablish the scope and legitimacy of the Iraqi government."
Screening for potential militants has been more formalized during the Mosul offensive than during past campaigns in an attempt to ensure that Islamic State, once routed from Iraq's second-largest city, doesn't regenerate, said Patrick Martin, an Iraq expert at the Washington-based Institute for the Study of War.
"It is an improved process ... but you are still going to have ISIS members who slip through the cracks," said Martin, using an acronym for the Islamic State terrorist organization.
Part of the challenge is identifying hard-core militants.
"The reality that the security forces and the justice system are dealing with is that a lot of people joined ISIS because they had to," Martin said, and some of the volunteers included "bureaucrats or street sweepers."
"It becomes a question of how you judge them," he said.
Human Rights Watch last week said it had found evidence that Iraqi government-backed Sunni militias patrolling south of Mosul on Nov. 29 executed four suspected militants without due process; their families claimed they were innocent. In another case, the group said, Iraqi forces and Sunni militias executed a suspect after he surrendered in Qayyarah in October.
A spokesman for Prime Minister Haider Abadi rejected the allegations.
"There are instructions to deliver these terrorists to the relevant security authorities to bring them to justice," spokesman Saad Hadithi said. "Violations are prosecuted and forwarded to the competent courts."
Some suspects brought to the court in Qayyarah were caught as they fled villages surrounding the city, at checkpoints and displaced-persons camps. Iraqi security forces screen civilians using a list of 57,000 Islamic State affiliates' names.
Judges refer about half of the cases to Ninewa Criminal Court, about 100 miles north in Sheikhan. If a witness provides evidence, that's enough to refer a case. If convicted, penalties range from 15 years for assisting militants to death for violent crimes.
The judges in Qayyarah have heard hundreds of cases since the Mosul offensive began Oct. 17, everything from people accused of being cooks and cleaners for Islamic State to a suspected suicide bomber who reportedly killed dozens of civilians.
Almost all suspects insist they're innocent. Some claim they didn't fight for Islamic State, just worked for the organization to pay the bills. Others blame relatives, or insist they've been confused with fighters who share the same name.
Some days, the judges work until midnight, without computers, stamping and filing stacks of documents. They travel to and from work under guard.
Every suspect is entitled to an attorney, and those who cannot afford them are provided court-appointed counsel. Lawyers drift in and out of the makeshift courtroom, fashioned from a residence formerly used by Islamic State.
Suspects await hearings crouched under guard in the hallway or the dirt yard, scraps of white cloth tied around some of their heads as blindfolds.
The man with the trimmed beard was one of eight cases judges heard that day. On Monday, the previous day, they'd heard 48.
In one case, a woman was accused of inserting metal teeth in her mouth to work as an Islamic State enforcer, or "biter," nipping female neighbors who violated the militants' strict religious code. The sole witness against her: her husband, enough to refer the case to a higher court, judges said.
A man arrested at a nearby camp admitted that his two brothers and four nephews were Islamic State police and fighters, but insisted he himself was not.
Another man was accused of raising money for Islamic State under the guise of helping displaced persons.
The judges asked suspects to provide information about the jihadis, and many did, although the quality of their tips varied.
Two men who confessed to setting off Katyusha rockets for Islamic State told the judges about a bomb-making factory in Mosul. Some suspects snitched on Islamic State-affiliated relatives.
Others were less cooperative.
The man with the trimmed beard was a challenge. The judges took turns questioning him.
"Why did your family stay in Mosul? Why didn't you let them come with you?" asked the clean-shaven judge, who wanted to be identified as Abu Yaman, a nickname. (Suspects also could not be identified, the judges said, because of security concerns.)
"My mom was scared," the suspect said. "I came through the only road that was open, through Gogjali. I gave the security forces my name and my family's name."
Abu Yaman, 46, flipped through the man's file in front of him. The suspect had worked as a city cleaner. Recently, another man had appeared before the judge who claimed to have cooked for Islamic State because his family needed the money. The judge had released him.
"Did you stay in your position after Islamic State came?" asked the second judge, Abu Ali, 53.
"Yes," the man said, and then, quickly, "No."
The judges exchanged a glance. Sometimes, one word decides a case.
They fingerprinted the suspect, and guards led him from the room less than 10 minutes after he arrived.
The next suspect, a young man with a mustache and shaggy hair, arrived pinching the legs of his gray sweatsuit nervously.
"When did you join Islamic State?" Abu Yaman demanded as the other judge smoked and studied the suspect.
"2015 and I stayed four months. … No, not me, my brother," the man said, fists clenching. "They left after the army came. They were in charge of collecting money and bothering people."
After Iraqi security forces freed the area, the man said, they told him to stay home. But he left to get food for his family and was arrested for the first time in his life.
Five minutes later, he was fingerprinted and escorted out.
"You can tell from his face he's not Islamic State," Abu Yaman said, as opposed to the man with the beard: "I'm pretty sure he was ISIS."
The next suspect, a bearded man in a brown dishdasha gown, had been arrested at a camp where he fled with his family. He said his relatives belonged to Islamic State.
"Just confess to me. It will be better for you," Abu Yaman said firmly. "I will send you to the security forces, and they will beat you."
The man refused to confess. A few minutes later, he was led back to detention.
The next suspect had only a few minutes to plead for his freedom.
"I have been here 25 days," he said. "I have a paralyzed leg. I have a family."
He, too, was sent back to custody.
Abu Yaman has been a judge for eight years, Abu Ali for 11 years. That's long enough to form impressions of suspects, they said, and also long enough to know it takes more than an impression to refer a case. They rule based on evidence, they said, not gut feelings.
By day's end, the judges had not referred any of the cases they had heard to the higher court — yet. They wanted to take more time to consider the evidence. With that, a guard drove them away.