Thousands of children in conflict zones have been held for months and sometimes years for alleged involvement with non-state armed groups or conflict-related offenses, Human Rights Watch (HRW) said in a report on Thursday.

The New York-based human rights group said in a 35-page report that children held by authorities in six conflict-affected areas have been subject to torture, abuse and arbitrary detention as part of vague and sweeping counter-terrorism laws.

"Governments are trampling on children's rights in a misguided and counterproductive response to conflict-related violence," said Jo Becker, children's rights advocacy director at Human Rights Watch. "Governments are detaining thousands of children, without charge, often for months or years, and often subjecting them to torture and ill treatment."

"Detaining children is the wrong way to deter them from involvement in future violence," she added.

The report examined the violation of children's rights in Afghanistan, Congo, Iraq, the Israeli-Palestinian conflict, Nigeria and Syria.

In Afghanistan, 214 boys were in juvenile rehabilitation centers on suspicion of being Taliban members, attempting suicide bombings, making or placing roadside bombs or providing assistance to armed groups, according to December 2015 Afghan government data. The number of children in detention may be significantly higher, HRW said, noting "torture is routine."

In Democratic Republic of Congo, hundreds of children have been arrested and detained for alleged ties to armed groups. Many children are held in appalling conditions and subjected to ill-treatment, HRW said.

In Iraq, hundreds of children have been detained for alleged association with armed groups, including the so-called "Islamic State."

"Security authorities commonly hold suspects, particularly terrorism suspects, incommunicado for weeks or months following arrest," often without lawyers, HRW said. The rights group said Iraqi security forces have arrested women and children for alleged terrorism related activities by males in the family. "Arresting family members because of their relationships to suspects, without evidence they have committed a crime, violates international law and amounts to collective punishment," HRW said.

Israel prosecutes between 500 and 700 Palestinian children in military courts every year, HRW said, most for throwing stones at Israel soldiers or illegal settlers in the West Bank. Prosecution of children in military courts without specialized juvenile justice safe guards is a violation of international law. Six Palestinian children were also in prolonged detention without charges or a trial.

"Large numbers of former child detainees have reported ill-treatment by Israeli security forces, including beatings, kicking, strip-searches, verbal abuse, and threats of sexual violence," the report said.

Many palestinian youth are rounded up for throwing stones at the Israeli Military or illegal Jewish settlers.

In Nigeria, where government forces are battling the extremist group Boko Haram, hundreds children have been rounded up and detained by authorities, HRW said. Boko Haram has recruited and kidnapped hundreds of child soldiers and used some as suicide bombers.

In Syria, at least 1,433 children have been detained, but only 436 have been released, HRW said, citing the Violations Documentation Center in Syria. Torture, arbitrary arrest and other abuses were reported. The status of many detained children in the war wracked country remain unknown.