Roukiata Sow looks tired. The mother of five has welcomed 26 people under the roof of her small brick house. “What will those kids become? Some haven’t been to school for more than two years … Are they all going to be bandits?” she asks.

She is sitting, her head draped in a long grey veil, with other women and girls in a small courtyard in front of her home in Dori, the capital of the Sahel region of northern Burkina Faso.

“In this neighbourhood only, there are about 4,000 displaced persons. Every week, more are coming. We never thought this situation could happen in Burkina Faso. It seemed far from us,” she says. “I don’t even like watching war movies on TV. And now, it happens at home. For real.”

This year more than half a million people have left their homes as a result of the insecurity, exiled in their own land. Most have been taken in by other communities, given shelter and a share of meagre resources by people like Roukiata Sow. Others are living in tents or public buildings.

“This is an unprecedented humanitarian crisis for the country,” says Metsi Makhetha, the UN resident coordinator. “The situation deteriorated so quickly, that we struggled to adjust the response to the level of emergency. We are now catching up, but so far we have only received 41% of the funds that would be needed.”

Until a few years ago, Burkina Faso had been spared the terrorist threat that has plagued its northern neighbour, Mali.

But now attacks by armed men are happening every week, mainly near the northern and eastern borders. Several Islamist groups are active, in addition to various trafficking networks that thrive in chaos.

A soldier searches a hut for materials that can be used to make explosives in northern Burkina Faso. Photograph: Michele Cattani/AFP via Getty Images

Badly trained and poorly motivated, the army has been struggling to contain the insurgency, in a war for which it was not prepared. Human rights groups have accused soldiers and militias of abuses that have fuelled the cycle of violence.

In the worst affected regions of the country, where the state has largely lost control, education has been put on hold. “Western” or secular education has been portrayed as unnecessary, or corrupting, by some radical Islamist preachers. Teachers have been killed and classrooms burned down.

About 1,800 schools have closed. “Tens of thousands of children are out of school, says Bernard Kitambala, Unicef office manager in Dori. “There have been threats, and some have been carried out.”

In a primary school in Dori, a teacher tries to make herself heard over the voices of a hundred children in the classroom. About half were displaced from neighbouring provinces or villages.

“It is not easy to teach in these conditions. They find it hard to focus. Two tents have been set up in the courtyard, and we’re using them as classrooms,” she says. “I’m scared, but we have to keep going. These children have the right to an education.”

For some, the danger has become too great. “We were in class when suddenly we heard gunshots. It was coming from everywhere around. We laid on the floor. Then we evacuated the students to safety,” says Tidiane Koundaba, a teacher in the village of Gorgadji, some 40 miles further west.

In a transit centre in Dori, he is waiting with several other teachers to be reappointed to a different area of the country. “The school was not directly targeted that time. But after they attacked the town hall, and the police station, we thought we might be the next target,” he says.

The violence has deeply traumatised those affected. Ramata, 15, was asleep at home late one April night when she was awoken by the sound of gunshots. “They came on motorbikes. The jihadists. They wore headscarves on their heads,” she says.

“They fired until dawn.” Her uncle and several other relatives were killed. Terrified, she ran into the bush. “I fled with my family, we were about 40 people. We didn’t even have time to put shoes on.”

Teachers in northern Burkina Faso have struggled to keep schools open in the face of rising violence. Photograph: Issouf Sanogo/AFP/Getty Images

Ramata now lives in Kaya, a city 60 miles north-east of the capital, Ouagadougou, which has become a refuge for many displaced families. She spends her days in an open space built for children and teenagers who have not yet been able to return to school, for lack of financial means or available space.

“Those children had to flee, some saw people being killed, many have nightmares,” says Lucienne Kontogom, the supervisor. “It’s important that we give them a sense of security.”

Here they play, receive basic education, and take part in group therapy sessions. With support from social workers, they try to understand what they have experienced.

“There’s a feeling of abandonment among those populations. Many feel that the state is doing nothing – or not enough – to help them. There’s a lot of bitterness,” says Chrizogone Zougmoré, president of the Burkinabe Movement for Human Rights.

“This very worrying. Because it’s a feeling that terrorist groups can manipulate. In these already marginalised regions, there’s a risk that a limited access to education and even fewer opportunities could drive more young people into armed groups.”