In a room full of loud teenagers, 17-year-old Mohammad Ehsan is the quietest. (The names of the boys in this piece have been changed to protect their identities.) The other boys in this juvenile rehabilitation center in the Afghan capital of Kabul are rough and boisterous; he takes the corner-most seat and avoids making eye contact. He speaks only when spoken to, sometimes answering with just a single word. As we talk, he stares at the floor or fidgets with the corner of his white shalwar kameez, as though he would rather be anywhere else than here.

His silence and his fear were hard-learned. Ehsan is one of 27 teenagers in this facility recruited and trained by the Taliban or the Islamic State to plant improvised explosive devices (IEDs) in the country’s endless war. Some, including Ehsan, were held in the Bagram prison located outside of Kabul, formerly operated by the United States. The other children are afraid of associating with them. “They’re too political and dangerous,” a young man incarcerated for murder said.

IED use surged in Afghanistan last year, killing or injuring 3,043 people. Children like Ehsan are particularly valued as bombers, their youth and size giving them cover during the stealthy planting of IEDs. At the facility, we’re introduced to seven of them, all between 13 and 17 years old—not all bomb planters but who were used in a variety of military roles by the Taliban.

A report by Human Rights Watch (HRW) in 2016 noted that the Taliban had been training and deploying teenagers for a range of military operations, especially for the placement of IEDs. The number of such recruits has soared since then. U.N. reports about the siege of Kunduz province in 2015 indicate that the Taliban used underaged child soldiers, some as young as 10 years old, as front-line soldiers. “The surge [of using children for insurgencies] began in mid-2015 as the Taliban made gains in areas they had not previously controlled, particularly in the northeast,” explained Patricia Gossman, the author of the HRW report and the group’s associate director in Afghanistan.

Ehsan has spent the last three years in captivity. He was born only a few weeks after the United States first sent troops into Afghanistan, and his early years, which he remembers happily, were spent among the relative peace and quiet that followed the fall of the Taliban regime in 2001. The oldest of the two sons of a pious family from eastern Afghanistan, his early education was at a school that opened not long after the U.S. occupation and was close to a U.S. provincial reconstruction team.

When he was 13 years old, though, Ehsan was approached by his uncle, he said, and asked to come with him. “I trusted him because he was my uncle. I had no idea he worked for the Taliban. … He took me to the Taliban, and they asked me to plant bombs in the city since, as a kid, I wouldn’t attract a lot of attention. When I refused, they beat me several times. I was so afraid,” he said, insisting, and later swearing on his life, that he was not a Taliban member himself.

Ehsan planted two roadside bombs in his district that claimed the lives of six civilians and injured eight others. He was caught soon after the attack. While being held in a local prison in his district, he met with the children of one of the men his bombs had killed. “They came to see me in jail. They were about my age. We didn’t talk, but it was a very painful moment,” he said, his face hard to read. Ehsan was later moved to the U.S.-built Bagram prison, where he was kept with others accused of working with the Taliban. When under U.S. control, it had a reputation for the abuse of inmates—which has reportedly barely changed since the Afghan government took over in 2013. “It was a difficult experience. They weren’t nice to us, and they sprayed us with poison gas that would make us unconscious,” he claimed, perhaps referring to tear gas or other riot control methods. “I was there for nearly 20 months and didn’t even get to see my family even once in that time.”

In contrast, the rehabilitation center has a deeply idealistic vision. With classrooms, a library, gymnasium, volleyball court, computer lab, and many other vocational courses, it focuses on reform and rehabilitation rather than incarceration. The children at the center are treated as victims rather than criminals. They are enrolled in regular classes that help them continue their education and are provided with vocational training and extracurricular activities, as well as regular personal counseling. But the center only has space for fewer than 200 children, a fraction of those in need in Afghanistan.

Several ministries, including those of education and public health, are working in tandem to provide services to the center. They’re joined by international organisations such as UNICEF and Children in Crisis, which contribute to creating a healthier environment. But the insurgents’ reach into the countryside remains strong, as does their ability to target vulnerable children.

The juvenile rehabilitation center spends considerable resources on helping radicalized children to reform, including counseling sessions with both psychologists and religious leaders and scholars. Part of the job is turning them away from the Taliban’s twisted version of Islam. “It’s not an easy job,” said Justice Minister Abdul Baseer Anwar, who runs the government end of the program. “We work with children who have been brainwashed to the extent that they falsely believe they are doing the right thing in accordance to the religion.”

“The influence of madrasa teachers was very important, too,” added Gossman, the HRW associate director. “Even if the child’s parents opposed their child joining the Taliban, a prominent uncle or other relative with ties to the Taliban may put pressure on the family.”

Five of the seven boys interviewed spoke of their training in the camps. “The Taliban used to tell us that they were waging jihad against the government and foreign forces. And that we needed to destroy all the road and infrastructure to weaken them,” 17-year-old Ahmad said. “I believed them because they showed us videos of the Americans attacking mosques and burning the Quran.” He added that he now realizes that the Taliban were wrong.

Originally, Taliban commanders sent boys to North Waziristan in Pakistan for training, but they’ve switched to sending them to largely local schools since Taliban territorial gains have allowed the establishment of new facilities or the control of existing madrasas. Taliban-run madrasas, whether locally or in Pakistan, also attract poor families because they’re not only free but they cover the boys’ room and board. “The role of madrasa teachers in selecting boys and convincing them to join is key, and since these boys want to prove themselves, they will follow the teacher’s directives rather than heed their parents,” Gossman explained. “Once they are in, however, they realize they cannot easily get out, even if their parents are trying to have them returned, and then the pressure and intimidation increases.”

Ghazi Noori worked with children labeled as the “most dangerous” in the years he has spent as a warden at the rehabilitation center, often referred to as the JRC. “It’s true they made mistakes, but they don’t know how to make wise decisions. That’s where we can help them,” he said. “I remember we had this one young boy who was brought to the JRC after being convicted on a national security crime. He wouldn’t change into the clothes we provided him because he thought they were from the U.S. and he had been brainwashed into hating the Americans.” Eventually though, after years of education and counseling—as well as discovering a talent for sports—the boy was able to live a normal life. “He was released, and he still plays volleyball. He calls me sometimes to tell me about his life,” Noori added.

But such success stories can be rare. Years of conditioning are hard to break. “Every child is stubborn, and we have to work with each of them, slowly and patiently,” Noori said, adding that their radicalization had been slow and complex and so the healing process had to be the same.

Fifteen-year-old Hussain described how he was trained. “We were taught the Quran, and their leaders explained why killing people for jihad wasn’t wrong,” Hussain said. He was caught during a raid on a Taliban camp six months ago and convicted of aiding the insurgency. While Hussain claims he was kidnapped from his family at gunpoint, he stayed with the Taliban for nearly six months. He insisted he never did anything illegal during his time with the Taliban and dodged questions about his role within the insurgency. “You don’t get an option or choice. If they ask you do something and you don’t do it or refuse, they kill you,” he eventually answered, reluctantly, all the while playing with a handmade ring on his finger that carried his and his fiancée’s initials with a heart in between. He hasn’t seen his fiancée for more than a year.

Emotional manipulation plays an important role in convincing the children to join the insurgency—but so does the detritus left behind by nearly two decades of war. “We see a lot of cases of depression and trauma,” said Yasin Qurbani, a therapist who has been working with children at the rehabilitation center for more than seven years. “Some of them had their family member killed in front of them. They were told that the foreign forces had insulted their religion and culture. They want revenge. They have been told revenge is the right way,” he explained. “It is hard to convince someone whose father was murdered to not seek revenge and kill people, especially if they’re a child.”

That’s how Ismail Khan, a 14-year-old from a village located close to the border with Pakistan, ended up at the center. Khan’s parents and younger sister were killed after a rocket struck their home during cross-border fire from Pakistan in 2014. “I wanted revenge on Pakistan. But I knew I was too young to join the army or the border police, so I joined the TTP [Tehrik-i-Taliban Pakistan],” Khan said, in a blunt and oddly cheerful conversation. “They also turned me down. One of their leaders said, ‘You’re too young. Don’t do jihad now. Go to a madrassa, and come back after you’re educated.’ But I insisted, and they had to let me in.”

Most of Khan’s training with the TTP leaders focused on religious instruction. However, at times, he was taken along for operations to help carry the arms and ammunition. It was during one such operation that he was caught, two years ago. Khan feels little regret or remorse, despite years in institutions, including a stint in Bagram. “I am not satisfied,” he said calmly. “I didn’t get to inflict damage on the Pakistani army with my own eyes. I am still very angry.”

Khan is a gifted and intelligent young man, having learned to read and write two new languages, including English, in less than two years. He scribbled two words using the English alphabet in my notebook—Polis Sarhadi—which means Border Police. “When I leave here, I want to join the border police, but my older brother says he will send me to Saudi Arabia to study,” he said, adding that he was afraid he might not get to follow his dreams. “My biometric data is now with the government. I’ll always be seen as an insurgent,” he said in a dejected voice.

As the war in Afghanistan escalates, Afghan officials are struggling to cope with new influxes of damaged child soldiers. Anwar, the justice minister, admitted that the resources and support for rehabilitating the children were dwindling. “There is a reluctance on the part of many countries in providing support to these children. Many of the European nations we reached out to see these as prisons and don’t want to extend their support,” Anwar said, adding exasperatedly, “The JRC is not a prison.”

But those who work with the children are rooting for them. “There is hope for them still because they are young and they were misled or forced or intimidated,” Qurbani said. “They don’t really want to hurt anyone.”