BAHRA, Iraq - Iraqi Kurdish peshmerga fighter Hakar Mustafa trades his Kalashnikov assault rifle at night for a notebook and pen, learning reading, writing and maths near the front line held against brutal jihadists.
The 21-year-old is one of dozens of members of the autonomous Kurdish region's peshmerga forces studying at a school in the northern Iraqi village of Bahra, some three kilometres (two miles) from the closest Islamic State (IS) group position.
A sign on a house in the village reads "Peshmerga School", and inside, camouflage-clad fighters crowd narrow wooden desks in a room with a whiteboard at the front.
"We weren't able to go to school" in the turmoil of the 1990s, a decade that included an uprising against now-executed dictator Saddam Hussein and inter-Kurdish fighting, said Mustafa.
He worked as a farmer, and "after 2003 and the fall of the former Iraqi regime... I joined the ranks of the peshmerga. I wasn't able to go to school, and remained illiterate."
According to the Kurdish regional education ministry, 15 per cent of the population is illiterate, down from a high of 32 per cent in the 1990s.
The problem in the peshmerga is not limited to Mustafa, who said fighters have been captured by IS because they could not read signs.
'Couldn't read the signs'
"Many of our colleagues fell into enemy hands by mistake because they were illiterate and didn't know where they were or couldn't read the signs telling them they had reached dangerous areas," he said.
Thousands of federal security personnel fled their posts after IS launched a sweeping offensive in northern Iraq, clearing the way for Iraq's Kurdish region to gain or solidify control over northern territory claimed by both it and Baghdad.
The peshmerga have since battled IS from the western border with Syria to Iran in the east, losing ground to a renewed northern offensive by the jihadists last August, but later driving them back with support from US-led air strikes.
Before, "when we went anywhere, we had to ask others to show us the place where we wanted to go," said Badreddin Biro Aziz, another 21-year-old peshmerga fighter studying at the school.
"We saw ourselves as weak," said Aziz, who like Mustafa was a farmer before joining the peshmerga. "Now I can read my name and the name of my father and other things."
In one class, more than 20 peshmerga follow what their teacher writes on the whiteboard, with some going up to read aloud or write on the board themselves.
The school at Bahra is the first set up near the front line with IS since the conflict began, but it follows an old pattern: there was a Kurdish school in the mountainous Nawbardan area when they were fighting Iraqi government forces in 1968.
The current school was the idea of Lieutenant Colonel Bindyan Hajji Jamil.