The children had all been shown videos of beheadings and told by their trainers with the Islamic State group (ISIS) that they would perform one someday. First, they had to practice technique. The more than 120 boys were each given a doll and a sword and told, cut off its head.

A 14-year-old who was among the boys, all abducted from Iraq's Yazidi religious minority, said he couldn't cut it right. He chopped once, twice, three times.

"Then they taught me how to hold the sword, and they told me how to hit. They told me it was the head of the infidels," the boy, renamed Yahya by his ISIS captors, told The Associated Press last week in northern Iraq, where he fled after escaping the ISIS training camp.

When ISIS overran Yazidi towns in northern Iraq last year, they butchered older men and enslaved many of the women and girls. Dozens of young Yazidi boys like Yahya had a different fate: ISIS sought to re-educate them. They forced them to convert to Islam from their ancient faith and tried to turn them into jihadi fighters.

It is part of a concerted effort by the extremists to build a new generation of militants, according to AP interviews with residents who fled or still live under ISIS in Syria and Iraq. The group is recruiting teens and children using gifts, threats and brainwashing. Boys have been turned into killers and suicide bombers. An ISIS video issued last week showed a boy beheading a Syrian soldier under an adult militant's supervision. Last month, a video showed 25 children unflinchingly shooting 25 captured Syrian soldiers in the head.

In schools and mosques, militants infuse children with extremist doctrine, often turning them against their own parents. Fighters in the street befriend children with toys. ISIS training camps churn out the Ashbal, Arabic for "lion cubs," child fighters for the "caliphate" that ISIS declared across its territory. The caliphate is a historic form of Islamic rule that the group claims to be reviving with its own radical interpretation, though the vast majority of Muslims reject its claims.

"I am terribly worried about future generations," said Abu Hafs Naqshabandi, a Syrian sheikh who runs religion classes for refugees in the Turkish city of Sanliurfa to counter ISIS ideology.

The indoctrination mainly targets Sunni Muslim children. In ISIS-held towns, militants show young people videos at street booths. They hold outdoor events for children, distributing soft drinks and candy -- and propaganda.

They tell adults, "We have given up on you, we care about the new generation," said an anti-ISIS activist who fled the Syrian city of Raqqa, the extremists' de facto capital. He spoke on condition of anonymity to preserve the safety of relatives under ISIS rule.

With the Yazidis, whom IS considers heretics ripe for slaughter, the group sought to take another community's youth, erase their past and replace it with radicalism.

Yahya, his little brother, their mother and hundreds of Yazidis were captured when ISIS seized the Iraqi town of Sulagh in August. They were taken to Raqqa, where the brothers and other Yazidi boys aged 8 to 15 were put in the Farouq training camp. They were given Muslim Arabic names to replace their Kurdish names. Yahya asked that AP not use his real name for his and his family's safety.

He spent nearly five months there, training eight to 10 hours a day, including exercises, weapons drills and Koranic studies. They told him Yazidis are "dirty" and should be killed, he said. They showed him how to shoot someone from close range. The boys hit each other in some exercises. Yahya punched his 10-year-old brother, knocking out a tooth.

The trainer "said if I didn't do it, he'd shoot me," Yahya said. "They ... told us it would make us tougher. They beat us everywhere."

In an ISIS video of Farouq camp, boys in camouflage do calisthenics and shout slogans. An ISIS fighter says the boys have studied jihad so "in the coming days God Almighty can put them in the front lines to battle the infidels."

Videos from other camps show boys crawling under barbed wire and practicing shooting. One kid lies on the ground and fires a machine gun; he's so small the recoil bounces his whole body back a few inches. Boys undergoing endurance training stand unmoving as a trainer hits their heads with a pole.

ISIS claims to have hundreds of such camps. The Syrian Observatory for Human Rights documented at least 1,100 Syrian children under 16 who joined IS this year. At least 52 were killed in fighting, including eight suicide bombers, it said.

Yahya escaped in early March. Fighters left the camp to carry out an attack, and as remaining guards slept he and his brother slipped away, he said. He urged a friend to come too, but he refused, saying he was a Muslim now and liked Islam.

Yahya's mother was in a house nearby with other abducted Yazidis -- he had occasionally been allowed to visit her. So he and his brother went there. They travelled to the Syrian city of Minbaj and stayed with a Russian ISIS fighter, Yahya said. He contacted an uncle in Iraq, who negotiated to pay the Russian for the two boys and their mother. A deal struck, they met the uncle in Turkey then went to the Iraqi Kurdish city of Dohuk.

Now in Dohuk, Yahya and his brother spend much of their time watching TV. They appear outgoing and social. But traces of their ordeal show. When his uncle handed Yahya a pistol, the boy deftly assembled and loaded it.

And he will never forget the videos of beheadings ISIS trainers showed the boys.

"I was scared when I saw that," he said. "I knew I wouldn't be able to behead someone like that. Even as an adult."