BEIRUT, Lebanon — After six days of deadly battles, the Kurdish-led militia that had been battling Islamic State fighters for control of a prison in northeastern Syria retook the facility on Wednesday, ending one of the most audacious attacks by the jihadist group since the collapse of its so-called caliphate nearly three years ago.
Dozens of militiamen and hundreds of ISIS fighters have been killed since the jihadists blasted their way into the prison in the city of Hasaka last week and joined rioting prisoners inside to seize control, taking the prison staff and about 700 boys detained in the facility hostage, militia officials said.
The militia, known as the Syrian Democratic Forces, or S.D.F., battled ISIS sleeper cells in surrounding neighborhoods and then laid siege to the remaining militants, who gave up on Wednesday after running low on food and water.
“The future was clear to them if they didn’t surrender,” said Aram Hanna, an S.D.F. spokesman. “The area was completely besieged and completely under the control of our forces. They had no other option.”
The officials said they were still trying to determine how many of their fighters and how many ISIS attackers and prisoners had been killed. An S.D.F. spokesman said that at least 30 militia fighters and more than a hundred militants had been killed.
Whether any of the 700 boys — held by ISIS fighters as human shields during the siege — had suffered casualties was also unclear on Wednesday, as well as how many prisoners may have escaped during the fray.
The battle for the prison dragged to the fore the unresolved humanitarian and security problems that the West has largely ignored since the S.D.F., backed by an American-led military coalition, drove ISIS from its last patch of territory in early 2019.
The militia captured the men, women and children who survived the collapse of the caliphate and locked them in prisons and detention camps that were meant to last only until other countries repatriated their citizens or helped find lasting solutions for the rest.
Terrorism experts and U.S. officials have long warned that the lockups could pave the way for a renewed insurgency.
The Aftermath of Syria’s Civil War
After a decade of fighting, many Syrians wonder if the country can be put back together.
“The makeshift prisons throughout Syria are a breeding ground for Daesh’s failed ideology,” Maj. Gen. John W. Brennan Jr., the coalition commander, said in a statement on Wednesday, using an Arabic acronym for the Islamic State.
“This is not a problem solely within this city,” he said. “This is a global problem that requires many nations to come together to develop an enduring long-term solution.”
The Hasaka prison, a converted training institute, was the largest of those run by the S.D.F. and held thousands of men who had been captured as the caliphate fell. Reflecting the Islamic State’s international draw, they came from countries across the globe and were packed into crowded cells.
None have been officially charged with crimes or have appeared before a judge.
The prison also held about 700 boys whose families had joined the Islamic State. S.D.F. officials deemed them dangerous, but human rights activists say their detention may violate international law and may also serve to radicalize them — creating a new generation of jihadists.
During the prison siege, they became hostages, raising concerns that they could be harmed and complicating efforts by the S.D.F. to retake the prison.
On Wednesday, Mr. Hanna, the S.D.F. spokesman, said that none of the children had been hurt. Other officials were less sure, saying they needed time to figure out what exactly had happened to the boys.
During the fighting, there were indications that they were not all fine, including voice messages obtained by Human Rights Watch from an Australian teenager saying that his head was bleeding and that he had seen the bodies of children who had been killed.
S.D.F. officials interviewed Wednesday acknowledged that ISIS had not just taken over part of the prison, as they said during the siege, but had taken over the entire prison complex.
The militants launched their attack Thursday with two suicide car bombs that blew open the entrance, S.D.F. officials said. Scores of armed fighters rushed in, barricading themselves inside the wards with rioting prisoners, clashing with guards and taking prison workers hostage, said Nuri Mahmud, a spokesman for Kurdish fighters in the S.D.F.
ISIS sleeper cells in surrounding neighborhoods seized buildings and grain silos from which they attacked militia forces heading toward the prison.
As the S.D.F. fought its way toward the prison, the United States joined the fight, using armored vehicles, attack helicopters and airstrikes.
For the last two days, S.D.F. forces imposed a siege on four or five buildings where the prisoners and attackers had refused to surrender and were holding prison workers and the boys hostage. The forces knew which building the boys were in and did not use heavy weapons near it, Mr. Mahmud said.
“ISIS tried to take advantage of the youths in the prison to a certain extent,” he said. “The forces were careful about that.”
By Wednesday, the besieged militants were running low on food and water and had no way to treat those who were sick or had been wounded in the fighting, said Siyamend Ali, who heads the media office of a Kurdish fighting group.
“We told them they could go back as they were, as prisoners,” he said. “In the end, they had no choice but to surrender or they would all die, so they decided to surrender.”
Soon, S.D.F. officials were posting images of long lines of tired-looking prisoners in sandals and tattered clothes lining up in the prison yard after surrendering.
S.D.F. officials said it would take time to ascertain the final death toll, assess all the prisoners and treat the wounded. Some of the wards were so damaged that the prisoners will have to be moved elsewhere, they said.
The prison lies in a predominantly Kurdish region of northeastern Syria outside the control of the Syrian authorities in Damascus. Since the U.S.-backed coalition and the S.D.F. repelled ISIS from the area, it has been run by an ad hoc administration affiliated with the militia that operates with wide autonomy but has not been recognized as an official government by any other nation.
The United States keeps about 700 troops in northeast Syria to work with the S.D.F. against ISIS, in addition to a smaller base near the Jordanian border in the south.
The prison attack was the clearest indication, S.D.F. officials said, that the Islamic State did not end when it lost its last patch of territory, the village of Baghuz to the south of Hasaka.
“We can’t say that ISIS is over,” Mr. Ali said. “It is true that we got rid of them geographically, but the presence of ISIS continues.”
Hwaida Saad and Asmaa al-Omar contributed reporting.