HASAKAH, Syria — They are the remains of the Islamic State, a once sprawling kingdom built by foot soldiers from around the world to terrorize and enslave those they conquered.

Hollow-eyed and gaunt, the men and boys look broken. Days are spent in halting conversation with cellmates who still have the energy, or staring blankly across the teeming, fetid cells. Many have lost limbs in the battles that led them here. Others have lost eyes and ears, a result, they said, of airstrikes.

As Islamist militants fought in March for their last square mile in eastern Syria, fighters and families from more than 60 countries streamed out of their stronghold to surrender into the custody of the U.S.-backed Syrian Democratic Forces, a Kurdish-led force.

Eight months on, more than 10,000 men and children are still crammed into at least 25 makeshift prisons, lingering in legal twilight. The Kurdish-led force that holds them does not have the capacity to investigate or try them, and their home governments are mostly unwilling to take them back to face trials there. 

Amid the abrupt withdrawal of U.S. troops and advancing Turkish and Syrian government forces, the shifting local landscape is posing an increasingly urgent question: What will become of these men and the potential threat they pose for the world outside their prison walls?

“Can you tell us anything?” a rail-thin German man, Zakaria Mohammed Ismail, 53, asked a reporter, craning his head through a window in his cell’s iron door. 

Behind him, prisoners in orange jumpsuits — some as young as 14 — were listless or flapped their hands in a vain attempt to fan the stiflingly hot air. Guards covered their mouths with green surgical masks against the stench.

European countries have mostly refused to bring their citizens home for trial, instead exploring the possibility of transferring the men across the border to Iraq, where more than 17,000 men and women have already been charged with terrorism offenses.

"They were all trying to cut a deal with the Iraqis where the Iraqis would take custody of their foreign fighters and use their system," said one U.S. official, speaking on the condition of anonymity because of the sensitivity of the issue. But the deal fell apart, according to two people with knowledge of the issue, after Iraqi authorities asked for payment and reserved the right to carry out the death penalty.

At least 48 “high-value detainees,” however, have been transferred to Iraq over the past month, according to U.S. and Iraqi officials.

Security for the prisons in northeastern Syria has deteriorated in the weeks since Turkey invaded the area on Oct. 9, seeking to clear Kurdish fighters from the border area, with half the guards redeployed to the front lines to resist the incursion. More than 100 people with alleged links to the Islamic State have escaped from prisons and detention camps during that period, U.S. officials say. 

The Islamic State’s leadership has urged supporters to attack detention facilities like these and break the prisoners out.

“Your brothers and sisters, do your utmost to free them and tear down the walls restricting them,” ISIS leader Abu Bakr al-Baghdadi said in his last known recording before he died last week in a U.S. Special Forces raid on his hideout in northwestern Syria.

Mass prison breaks could bolster the group’s ranks at a critical time. The hasty withdrawal of U.S. troops from parts of Syria’s northeast is threatening to subvert the fight against Islamic State remnants, which continue to carry out a steady stream of small-scale attacks across the region. In an audio recording released Thursday, the group’s new spokesman, Abu Hamza al-Qurashi, reiterated the slain former leader’s call to “free the prisoners.”

Prison breaks have a storied history in the Islamic State. The group’s rise to power was fueled by a string of audacious escapes from Iraqi prisons in July 2012 and 2013 that sent hundreds of militants back to the front lines. 

On Oct. 12, a car bomb exploded outside the perimeter wall of a prison originally built by the Syrian government, lighting up the night sky and causing detainees to riot. “They thought they saw the opportunity to escape, and went mad in every cell. It was chaos,” said Hossam, an officer in charge of the old government prison. Like other wardens, he spoke on the condition that his full name not be used because of concerns that his family might be targeted by Islamic State sympathizers. Amid a cacophony of jeers and metal bed poles hitting the cells’ iron doors, it took hours for guards to restore calm.

News of Baghdadi’s death did not appear to have reached the prisoners in the days afterward. Nor had word of the Turkish invasion, even as fighting raged 30 miles away.

“They know things are happening out there, they just don’t know what,” said Hossam.

Guards are doing what they can to stop news of the invasion from leaking into the cells, fearing that knowledge of the deteriorating security situation might incite unrest. Televisions have been disconnected, and family visits, where they were possible, are on hold. 

“Information is like oxygen to them. We are doing everything we can to stop the flow,” said an officer who gave his name as Hassan. “But how can the world leave us with this place? All its citizens are here and we are shouldering the burden for all humanity.”

Even before the Turkish offensive, the Kurdish-led force barely had infrastructure to cope. The speed at which the caliphate’s last inhabitants poured out of their final redoubt sent authorities scrambling to repurpose schools, large buildings and anything else that might double as a detention facility. 

Prison authorities said there are now roughly 10,000 prisoners held in just the two facilities visited by a Washington Post reporter this week. But officials from the U.S.-led military coalition said there were at least 23 more detention facilities across the region, indicating confusion about exactly who was being held where. 

In addition to the prisoners, tens of thousands of women and children who lived under the caliphate are detained in camps in northeastern Syria — notably the al-Hol camp, which is now home to about 70,000 people.

The scale of the prison problem was captured on a bank of CCTV cameras in one of the detention facilities. In cell after cell, the prisoners were packed so tightly there wasn’t enough floor space for everyone to lie down without resting their limbs on others, and men would trip over each other as they tried to pass.

Louisa Loveluck/The Washington Post

The military coalition had provided the orange jumpsuits, wardens said — creating jarring visual parallels with Guantánamo Bay, or the brutal execution videos that the Islamic State made themselves.

“You should have seen their faces when they first saw the jumpsuits,” a guard said. “They thought we were going to do what they did to other people. They thought we were going to kill them.”

The International Committee of the Red Cross has access to the detainees. Other international organizations have limited visibility.

Many of the prisoners were part of a conquering army that swept across borders, forging a new empire based on a radical interpretation of their faith. This campaign involved genocide against Iraq’s Yazidi minority and the imposition of extreme punishments.

But lacking investigations into individual conduct, foreign governments say it is impossible to know what part specific prisoners had played in the atrocities. Most have yet to be questioned, guards say. In many cases, Syrians and Iraqis were conscripted after their hometowns fell under Islamic State rule. Some continued doing their same jobs after the creation of the caliphate out of financial necessity.

Inside a former school complex, there were dozens of children. 

A 14-year-old Syrian boy, Abdullah, clutched the window to his cell as he asked to be moved to a place for only children. “I don’t want to be here, please,” he said. 

In the jail’s clinic, another 14-year-old, from Iraq, said he had sent his mother a letter through the International Committee of the Red Cross but heard nothing back. “I’m sorry, I’m just too sad,” he said, on the verge of tears. “I just want to see her.” 

The scene around him was shocking. Pale, sick prisoners with shaved heads filled almost every gap on the floor. Their faces, legs and chests were riddled with shrapnel, and in many cases, broken bones had been reset with thick metal rods and bolts.

“You can see that we have entered hell,” said Yasser Mohamed Abdulazim, a prisoner who said he had traveled to Syria from Holland in 2015, as the Islamic State group made headlines around the world for its atrocities. 

SDF officers described their work as a duty, but a heavy one. Most had fought against the Islamic State for years. Another officer said he had been a student when the Syrian war began eight years ago. The youngest of four brothers, all of them fighters, he was the only survivor of the military campaign.

“It’s heavy work,” the 24-year-old said softly, looking down at his fingernails for a moment. “I want to continue my studies, not carry a gun, I don’t like this uniform. But in the end you have to defend your family and community. Circumstances have forced us here.”

Ossama Mohammed in Hasakah and Ellen Nakashima in Washington contributed to this report.