BEIRUT, Lebanon — The boy did not want to see a beheading, so he held his mother’s hand tight and tried to close his eyes. But seeing it was mandatory when the Islamic State ruled his hometown in northern Syria: If you were out on the street, you had to watch.
The boy, now 11 and a refugee in Beirut, reckons he saw 10 beheadings, and once he saw a man accused of a crime being thrown off the top of a building. Videos of executions were shown after the executions — and children were invited to watch inside mosques. “Some of my friends, they used to go and watch,” said the boy, who gave only his first name, Muhammad. “They liked it.”
Even by the brutal standards of the Syrian civil war, children growing up in areas ruled by the Islamic State have experienced and witnessed astonishing brutality. Schools have been closed for years. Polio has made a comeback. Boys have been recruited to fight.
Now, as foreign militaries and local militias try to flush out the Islamic State from its last redoubts in Syria, children fleeing the violence have to dodge airstrikes, snipers and then thirst and scorpions as they make their way across the desert.
Danger looms even when they reach safety. The militias taking on the Islamic State are also recruiting children to fight, according to aid workers and United Nations officials. Aid workers say children are being lured with money, guns and an inflated sense of importance — an allegation denied by a spokesman for the Syrian Kurdish fighters and Arab militias that are collectively known as the Syrian Democratic Forces and are backed by the United States.
It is indisputable, though, that millions of Syria’s young people have grown up amid trauma. Aid workers are just beginning to get a glimpse of it.
One pediatrician, examining toddlers who had recently fled Raqqa, the city where the Islamic State, also known as ISIS, has its Syrian headquarters, was unnerved by how weirdly listless they were in response to her prodding and poking.
“A child under 2 years is the most difficult child to examine,” said the doctor, Rajia Sharhan, who works with Unicef. “A child starts to fight with their arms, legs, even cries. This is normal.”
But these children did not resist or kick at all. “They were just looking at me, like, ‘Do what you want,’” Dr. Sharhan said. “I think it’s because of the trauma they’re suffering.”
As the military coalition led by the United States, and backed by Kurdish and Arab militias, encircle Raqqa, there are wildly divergent estimates of how many people are left in the city — perhaps as few as 20,000. Conditions inside are awful.
There is not enough drinking water: What comes out of the tap makes people sick, and to get water from the Euphrates river is to risk being shot or bombed.
Mahmoud, a Raqqa resident who fled a year ago, said friends told him that food was so scarce that they saved it for their children and pretended to chew at meal times, to fool them.
Bread is about the only food that many of Raqqa’s residents can afford to buy, a survey in early July found. The city’s electricity was cut long ago, and at the time of the survey, conducted by Reach, a nongovernmental group, there was no fuel left to run generators. The Islamic State had dug so many tunnels that the sewage pipes were damaged, and rats roamed through some neighborhoods, the survey found. The World Health Organization confirmed one case of polio in Raqqa in June.
And then there are the airstrikes. A United Nations panel in early June said coalition airstrikes had killed hundreds of civilians around Raqqa.
More than 200,000 people fled the city between April and July, according to the United Nations, and they poured into areas recently captured by the Arab and Kurdish militias of the Syrian Democratic Forces, or S.D.F.
The journey out of Raqqa takes children through terrain that is still heavily mined. Fleeing fighters have left booby traps and bombs. Temperatures soar well past 100 degrees, and there is little water in the dry, barren countryside.
“They are exhausted, they are stressed, they are dehydrated,” said Gosia Nowacka, the emergency coordinator for Doctors Without Borders, who works in a camp for displaced people about 40 miles from Raqqa.
Aid workers tending to the displaced say children wake up with nightmares and wet their beds. They tell their mothers to cover themselves from head to toe, as required by the Islamic State. They play war, dividing into teams of ISIS fighters and anti-ISIS militias.
Mahmoud, the former Raqqa resident, said he was alarmed to see small boys acting tougher and older than their age. Even in the makeshift camps, beyond the control of ISIS, they tie black bandannas around their heads when they play, like ISIS fighters. They listen to ISIS propaganda songs. They ask him to get them guns. “You don’t see children living their normal age,” he said. “You see grown-up men.”
Schools in Raqqa, as in much of Syria, have been shut for years. Informal math lessons reflect the students’ new reality: One gun plus one guns equals two guns, said Sonia Khush, the Syria coordinator for Save the Children.
In a survey carried out across Syria — not just in ISIS-controlled areas — Save the Children found that nearly half the adult respondents said they had seen children who had lost the ability to speak or had developed speech impediments since the start of the war.
Wadha was among the lucky ones. She fled Raqqa two months ago with her husband and two children. They had enough money to rent an apartment in a nearby town, Tal Abyad, now under S.D.F. control.
Her daughters are still terrified of the sound of fighter planes. They are afraid to leave the house without covering themselves completely, still mindful of ISIS’s edicts. No schools are open yet in the town — many were damaged in the fighting — and at night, Wadha said, she stays up to make sure scorpions do not crawl into her children’s bed.
Even so, it is better than Raqqa. “I won’t say life is bright and perfect here, but we saw the worst, so everything after that doesn’t matter,” she said.
The one constant danger facing children is recruitment by soldiers. The Islamic State routinely enlisted children to carry out some of its most heinous crimes, including suicide attacks, and boasted of training what it called “caliphate cubs.”
The other jihadist umbrella group, known as Hay’at Tahrir al-Sham and believed to be linked to Al Qaeda, has also enlisted boys as young as 15, according to the Independent International Commission of Inquiry on the Syrian Arab Republic.
Paulo Sérgio Pinheiro, the chairman of the commission, said his office had documented a “significant increase in child recruitment” by the S.D.F., too, as part of its Raqqa offensive. Mr. Pinheiro said the Kurdish police had “arrested men and boys at checkpoints throughout areas under their control,” on suspicion of supporting ISIS or for not joining their militia.
Other United Nations officials say they have verified reports that people accused of being ISIS sympathizers have been turned over to Syrian military intelligence.
One aid worker for a private agency who has been in the region for the past several months said he had heard of at least five teenage girls and several dozen boys who had been recruited by the S.D.F. “Children are made to feel they are very important,” the aid worker said. Like others, he did not want to use his name or the name of his organization, for fear of retribution.
The S.D.F. spokesman, Mustafa Bali, denied the reports of child recruitment, saying that his forces were fighting “the mentality of child recruitment.”
“So how can we be accused of that?” he said in an interview. “I absolutely deny all these allegations.”
Child conscription is against international law, and the largest Syrian Kurdish militia carrying out anti-ISIS operations in the area, the Kurdish People’s Protection Units, known as the Y.P.G., has pledged not to recruit children.
Geert Cappelaere, Unicef’s regional director, spoke of the “horrors” that children faced even after they escaped Raqqa, stopping short of assigning blame.
“They are being detained, abused and stigmatized for perceived affiliations,” he said in a carefully worded statement in mid-July, “while tensions are high between and within communities.”
Muhammad, the boy who escaped to Beirut to join his father, ran away from his hometown, Maskanah, after ISIS seized it. The militants forced him to grow his hair long, but in a rebellious moment, he cut it off, and both he and his barber were hauled in for a scolding.
His childhood was transformed in other ways. The Islamic State took over his school and painted it black. Chopped-off heads were displayed in the town square. Neighbors informed on one another.
Muhammad cut his hair again as soon as he reached Beirut. He colored a swish of it platinum blonde and swept it upward, with pomade, so that he looked a bit like a unicorn, with the face of a cherub.
Most days, he sells potato chips at a shop. On weekends, he helps his father manage a bakery. For fun, he plays soccer with other Syrian boys — in bright tropical print shorts, forbidden under ISIS.
He talks in his sleep some nights, his father said. Muhammad tells his father about the beheadings. “He has seen so many,” his father said. “He’s used to it.”