BEIRUT, Lebanon — Fighters from the Islamic State attacked a prison in northeast Syria in an attempt to free thousands of their comrades, one of the boldest assaults by the terrorist group in the Middle East since the fall of its so-called caliphate three years ago, U.S. and Kurdish officials said Friday.
The attack, which began Thursday night and was continuing late Friday, set off deadly clashes with the Kurdish-led militia that controls the area, killing dozens of people and allowing scores of prisoners to flee, at least temporarily, the officials said.
Across the border in Iraq, Islamic State fighters launched one of the deadliest attacks in months there on Friday, killing 11 Iraqi security force members in a pre-dawn attack on an army post in Diyala Province.
The twin attacks highlighted the fragile security that persists in territories once ruled by the Islamic State, and showed that the jihadists, while greatly weakened, can still cause havoc for allies of the United States.
The new violence also drew attention to the unfinished business of the military defeat of the group in Iraq and Syria in 2019: tens of thousands of former residents of its so-called caliphate, fighters and their families, who are now indefinitely detained by a United States-backed militia that doesn’t want them but can’t get rid of them.
The ISIS fighters launched their assault on the prison in the city of Hasaka, Syria, on Thursday evening by detonating a car bomb near the entrance and then unleashing hails of gunfire at the guards, the officials said.
The fighting spilled into the surrounding neighborhood, killing dozens of people, including civilians, and filling the air with automatic gunfire as residents fled.
As the fighters attacked, the prisoners rioted, burning blankets and plastic and trying to help the attackers set them free.
Late Friday, Islamic State fighters still controlled about a quarter of the prison’s northern area, and violent clashes continued there and in a neighborhood to the west, said Farhad Shami, the spokesman for the Kurdish-led militia, known as the Syrian Democratic Forces, or S.D.F.
It is unclear how many prisoners managed to escape and for how long.
Mr. Shami said that 89 prisoners had broken out on Friday but were caught by the S.D.F. and returned to the prison. A local news agency published a video that appeared to be of those men, bearded and with no shirts, being transported in the back of a truck.
Mr. Shami said the S.D.F. was not aware of any successful escapes but that there have been unconfirmed reports of individual prisoners making it out.
Sabereen News, an Iraqi news outlet affiliated with Iranian-backed militias, said dozens of escaped prisoners were arrested near the Syrian-Iraqi border as they tried to flee to Iraq.
The prison holds about 3,500 men who were arrested by the S.D.F. during battles to drive the Islamic State out of territory it controlled in eastern Syria. The militia partnered with an international military coalition led by the United States to fight the Islamic State, which, at its height, ruled territory the size of Britain in Syria and Iraq.
A United States military official said that aircraft from the anti-Islamic-State coalition had carried out at least two airstrikes targeting “a significant number” of Islamic State attackers and escapees outside the prison.
The coalition has surveillance aircraft overhead to try to help the Syrian forces on the ground, but no United States forces were directly involved, the official said.
Mr. Shami said that at least seven of the Kurdish-led security forces had been killed in the clashes, a number that was likely to rise because about 50 others were gravely wounded, some shot by snipers. The Syrian Observatory for Human Rights, a conflict monitor based in Britain, said that 39 Islamic State attackers, 35 members of the Kurdish-backed militia and five civilians had been killed.
The Syrian Observatory said that Islamic State fighters inside the prison were holding guards hostage. Mr. Shami said there were no hostages.
Kurdish officials in northeast Syria have long warned that they did not have the resources to securely hold so many prisoners in a makeshift prison, and that members of the Islamic State still at large would be likely to try to break them out.
Reflecting the diversity of the Islamic State’s ranks, the prisoners hail from dozens of countries, most of which have refused to take them back.
During a visit to the prison in 2019, reporters for The New York Times saw hundreds of men, many of them emaciated and injured, dressed in orange jumpsuits and crammed into crowded cells. Those interviewed either denied they had been with the Islamic State or claimed to have had nonviolent jobs as teachers or cooks.
The Times also found more than 150 children, ages roughly 9 to 14, held in crowded cells. It is not clear where they are now.
Mr. Shami said Friday that there were about 700 boys under age 18 in the prison but that he did not know their current situation.
Human rights organizations have criticized Western governments for not repatriating their citizens from northeastern Syria, comparing their indefinite detention without trial to the plight of men held in the U.S. detention center in Guantánamo Bay, Cuba.
In addition to the men held in prisons, more than 60,000 others, mostly women and children, who were detained as the Islamic State’s so-called caliphate fell apart are held in camps nearby that aid groups have warned are unsanitary and serve as jihadist recruitment centers.
U.S. officials and terrorism experts have warned that the continued detention of these people risks sowing the seeds of a future insurgency.
“Unless we find a way to repatriate them, reintegrate them and de-radicalize them, we’re giving ourselves a gift of fighters five to seven years down the road,” Gen. Kenneth F. McKenzie Jr., the head of the Central Command, said last April.
Jane Arraf contributed reporting from Baghdad, and Eric Schmitt from Washington.