NORTHERN SYRIA — Gaunt men in orange jumpsuits lay side-by-side like sardines on the floor of an ISIS prison in northeast Syria. Crammed in dozens to a cell, several inmates were missing limbs or covered in burns — the scars of years of bitter fighting in the region.

The Kurdish-led Syrian Democratic Forces (SDF), who have been a crucial U.S. ally in the fight against the Islamic State group, guard the prison, which houses some 5,000 inmates.

The SDF continue to guard the facility despite President Donald Trump’s decision last week to pull troops out of northeast Syria to make way for a Turkish operation in the region. That operation is now a full-fledged invasion, as Turkish troops push farther south into Kurdish territory and President Bashar al-Assad’s Syrian regime forces push north to help Kurdish fighters repel Turkish troops.

Inside an ISIS prison in northeast Syria. None of the inmates who spoke to NBC News said they had been ISIS fighters. NBC

But that might not be the case for much longer. Facing a chaotic, fast-moving conflict, which has seen the balance of power shift away from the U.S. to Assad and Russia’s Vladimir Putin and forced tens of thousands of people from their homes, the guards are now threatening to leave if the conflict deteriorates.

And the prisoners are trying to break out on a daily basis. The consequences of this for the region, caused by the U.S. decision to pull its troops out and the Turkish decision to move in, could be vast.

The cramped facility is outside the city of Hasakah, one of the main urban centers in northeast Syria, and many people have reportedly fled there from the creeping Turkish invasion.

Many of the prisoners who spoke to NBC News appeared to know little of the chaos that was unfolding around them beyond the confines of their compound. But with the sounds of explosions in the distance, the prison guards said the inmates were growing increasingly restless, with some trying to start riots.

An SDF prison warden told NBC News this weekend that if the situation in the area continued to deteriorate, the guards would have no choice but to lock the doors and leave for the frontlines.

Turkey sees the Kurdish People's Protection Units that leads the SDF as a threat to its territorial integrity and an extension of the separatist Kurdistan Workers’ Party, which is considered a terrorist group by the United States.

“If there was an attack on the prison, we'd lock all the doors and go to the areas that they are in to fight and protect northern Syria,” said the warden, Sarhat Amudi, referring to Turkish forces.

In that case, it is unclear how long security in the prison would last.

Members of the special forces of the Kurdish-led Syrian Democratic Forces (SDF) during preparations to join the front against Turkish forces, on Oct. 10, 2019, near the northern Syrian town of Hasakah. Delil Souleiman / AFP - Getty Images

“There are attempts to break the doors of the prison daily,” Amudi said. “When they hear explosions nearby they know something's happening and they start to rebel inside the prison.”

None of the prisoners who spoke to NBC News admitted to being ISIS fighters. Many said they had lived under Islamic State rule until the last stronghold of the caliphate, Baghuz, collapsed this year falling into the hands of the SDF. And not all were obviously of fighting age, with elderly men and a boy who claimed to be 14 among the inmates.

“I came from Holland to help the Syrian people almost five years ago,” claimed one inmate, Yasser Mohammad Abdulrahim.

Abdulrahim, 41, who said he was Egyptian but lived in Holland, said everyone in the camp was desperate for information as to what was happening on the outside and wanted to get out so they could be reunited with their families who, they presumed, were in camps also guarded by the SDF.

“Everybody has a good feeling that somebody else will take over here,” he told NBC News. “When you are drowning in water and you see a boat come close to you, that’s how we feel.”

There have been reports of security issues in an SDF camp holding the families of ISIS fighters. The SDF and Syrian Observatory for Human Rights said Sunday that close to 800 members of a camp near the town of Ain Eissa had escaped after Kurdish guards were forced to leave their posts as fighting neared the camp. NBC News has been unable to independently verify the claim.

“President Trump is responsible for this," Amudi, the warden, said. "He has the capability to stop Turkey's enmity against northern Syria and can provide air cover for the SDF.”