IRBIL, Iraq — Iraq and the Kurdish regional government have charged hundreds of children with terrorism for alleged affiliation with the Islamic State group, often using torture to coerce confessions, Human Rights Watch said Wednesday.

In a report, the New York-based group estimated that Iraqi and Kurdish authorities were holding approximately 1,500 children for alleged IS affiliation in detention at the end of 2018. It said the prosecutions are often based on dubious accusations and forced confessions obtained through torture.

The children are then sentenced to prison in hasty and unfair trials, HRW said.

Belkis Wille, senior Iraq researcher at Human Rights Watch, said the approach that Iraq has adopted is one that “completely fails” to acknowledge what is commonly understood and reflected in international law, which is that children who were forcibly recruited should be treated as victims, not criminals.

Iraq declared victory against IS in December 2017 after three years of bloody battles that killed tens of thousands and left Iraqi cities in ruins. The country is grappling with a massive legacy from the fight, which includes thousands of detainees, including children, who are being sentenced in rushed trials.

“Children accused of affiliation with IS are being detained, and often tortured and prosecuted, regardless of their actual level of involvement with the group,” said Jo Becker, children’s rights advocacy director for HRW. “This sweeping punitive approach is not justice, and will create lifelong negative consequences for many of these children.”

The report said kids recruited by armed groups should be recognized primarily as victims who should be rehabilitated and reintegrated into society.

The 52-page report, titled “‘Everyone Must Confess’: Abuses Against Children Suspected of ISIS Affiliation in Iraq,” criticized what it described as a deeply flawed screening process that often leads to detention and prosecution of children regardless of whether they have any involvement with IS, or the extent of that involvement.

It cites the case of a 17-year-old detainee who said he worked at a restaurant in Mosul that served IS members, and believed that his name appeared on a “wanted” list because IS took his identification so he could be paid.

“What we see are extremely brief trials in the cases of these boys. Every single one of these trials proceeded solely on the basis of the confession that was produced by their interrogation, often with the use of torture,” Wille said.

“After the trial is done, usually in … five-minute or a 10-minute period, they receive their sentence and they return to prison.”