Updated

Every school day, Abdirizack Hussein Bashir rises at dawn for an eight-kilometer (five-mile) trek through a dangerous forest where he sometimes faces harassment by Kenyan army patrols hunting down extremists.

Now the 12-year-old's dream to become a doctor is threatened. Attacks by the al-Qaida-linked al-Shabab against non-Muslims have forced the transfer of hundreds of teachers from the border area with Somalia, where the extremist group is based. Schools have closed and thousands of children are affected.

At least 224 primary schools and 42 secondary schools in Wajir County can no longer function after non-local teachers fled. The exodus was caused by the Feb. 16 al-Shabab attack on a primary school in which two non-Muslim teachers were killed. Kenya's Teachers Service Commission transferred 329 teachers elsewhere for their safety. Many others left on their own. In all, 917 non-Muslim primary school teachers have left the region.

It is the largest-ever mass exodus of teachers from the region, observers say.

Analysts say the extremist group threatens gains in education in a region that until recently was the most marginalized in Kenya and has been described as a hotbed for recruitment for extremist groups, which oppose Western education. Children out of school become easy targets.

For al-Shabab the closure of schools will be seen as "a success," said Abdullahi Boru Halakhe, an expert in countering violent extremism.

"Schools and education is one of the antidotes against the narratives of the (extremist) group. Thus, if you close the school, how else can you build a counter-narrative?" he asked.

Al-Shabab has carried out a wave of attacks in Kenya since 2011, calling it retribution for Kenya sending troops to Somalia to fight the extremists. Attacks include the April 2015 raid on Garissa University that left 147 people dead. Teachers near the Somali border have been targeted, including in a November 2014 attack on a bus in neighboring Mandera County.

Some 120 non-Muslim teachers have left their posts in Mandera County due to the latest insecurity. The teachers have been sleeping in the Kenya National Union of Teachers boardroom for nearly two months and spend their days camped out at the offices of their employer, the Teachers Service Commission. Police routinely use tear gas on them as they protest and demand better protection from the extremist threat.

"We have asked the government to transfer teachers where they feel safe," said the union's secretary-general, Wilson Sossion.

The threat of attack is not the only problem non-Muslim teachers face in the predominantly ethnic Somali region, said Peter Amunga, an education activist. Discrimination by the local community and radicalized students are other challenges. Non-Muslims make up 90 percent of the teachers in the border areas as marginalization and nomadic culture have limited the number of local ones, he said.

Wangechi Nderitu, one of the teachers camping out at the Teachers Service Commission offices, said one student at a neighboring school who was punished by teachers went to train with al-Shabab in Somalia for two years then returned in late 2015, took his father's gun and went after the teachers. Luckily they had been transferred, he said.

Despite teachers' concerns the government has forced them to stay in the region without providing additional security, Nderitu said. He said his bank accounts had been frozen and that the Teachers Service Commission says they won't be released until he and his colleague go back to work.

"This is blackmail," Nderitu said. "That's why we are stranded here. The Teacher Service Commission did not respond to a request for comment.

The government's response has been sub-optimal, said Halakhe, the expert in countering extremism.

"While there is an acknowledgement that there are no easy answers to what is obviously a complex and complicated problem, the government has failed even to do even the basic like, for instance, stationing security officers at some of the schools," he said.

Al-Shabab has exploited the region's history of marginalization for recruiting and propaganda, he added. The region's attempt to secede and join Somalia in the 1960s was quashed with military force and successive governments neglected the area until Kenya's new constitution in 2010 ensured that all regions received resources for development.

"In this latest situation, al-Shabab could say to the potential recruits: 'Look, your government cannot even provide you with a modicum of security, come and join us,'" Halakhe said.

Kenya's Parliament has approved a government plan to hire 88,000 teachers to address a nationwide shortfall of more than 104,000. For Wajir County, Education Secretary Amina Mohamed has said 1,200 teaching assistants will be recruited to step in until replacements are found.

If those replacements are not from the region, however, they soon will seek transfers as well, said Sossion with the teachers' union. A "permanent solution" would be to train more locals who are ethnic Somali and Muslim, he said.

For Bashir, the 12-year-old student, the politics surrounding the school closures doesn't matter.

"Now that there is no more class, what will I do with all this time?" he asked The Associated Press.