Each morning, they scrabble through a drainage pipe under a busy main road slicing through the unforgiving landscape between Jerusalem and Jericho, where hard-baked stony hills roll down to the Dead Sea.

At the end of the school day, they clamber back down to the drainage pipe to pass beneath the thundering traffic on their way home.

But, after today, the last school day in the academic year, the pupils of Khan al-Ahmar primary in the West Bank cannot be certain their school will still be standing come September.

Head teacher Hanan Awad fears that if the building is left empty, bulldozers will rumble up the hill from the main road to tear down the illegal two-year-old structure built out of old car tyres and mud.

So she and her team of nine women teachers are planning a programme of children's summer activities to keep the building occupied. To take part, around a third of the school's rollcall of 80, who live on the other side of the road, will have to crawl through the pipe, as they do every day simply to get to class.

The road is the principal reason why the school was built. Route 1, a major Israeli artery, connects Jerusalem to the Dead Sea and the settlements along its spine. Dozens of tiny Bedouin encampments also perch on the rocky hills. Until 2009, young children from Khan al-Amar risked their lives walking or hitch-hiking the 22km to schools in Jericho. Israeli authorities do not permit buses and shared taxis to stop on the roadside. Five children have died after being hit by cars in the past few years. The only vehicle access to Khan al-Amar is through a gap in the roadside barrier, scheduled to be closed in the future.

After some parents withdrew their younger children from school rather than risk the perilous journey, the Bedouin villagers decided to build their own establishment. An Italian architect, Valerio Marazzi, suggested an innovative construction using discarded car tyres and mud. The Bedouin men and volunteers collected around 2,000 tyres from West Bank rubbish dumps and built the school in a month. It serves five small communities, two across the highway.

The Israeli Civil Administration, which governs 62% of the West Bank, swiftly issued a demolition order as the school, along with other village structures, had been built without a permit - which is practically impossible to obtain. Legal challenges to the order stayed its execution until the end of the last school year, but since then the threat of demolition has hung over the school and the community.

Eight-year-old Nisreen, dressed in her blue-and-white striped uniform and missing a front tooth, is well aware that the school's days may be numbered. "I know it might be demolished by the Israelis," she says, shyly adding that she likes reading best. "I want to stay here."

The school is just a few metres walk from her family's home, built out of wooden crates, tarpaulin, wire and string. Nisreen's older brother leaves at 6am to get to school in Jericho, returning at 5pm after a long, hot uphill journey.

The inhabitants of the five encampments straddled across Route 1 are members of the Jahalin Bedouin community. Originally from the Negev, in southern Israel, they fled to the West Bank during the 1948 war. Their makeshift homes have no running water, sanitation or electricity. They have no regular access to health care.

Nisreen's father, Eid Hamis Swelem Jahalin, who has a degree in accountancy from the West Bank's Birzeit university, worked as a driver and labourer in the nearby Israeli settlement of Kfar Adumim for 20 years until the settlers barred Bedouin workers.

Now most of the men in the encampment are unemployed. The traditional herding grounds for their goats and sheep have been swallowed up by the settlement, and they claim the settlers and their security guards dig up crops they plant in the arid ground.

Hamis shows a picture on a mobile phone of his wife lying on the ground being kicked by a man, taken last Monday. It is the most recent example of a string of attacks by settlers on the Bedouin villagers, he claims.

The Israeli authorities want the Bedouin to move to a designated area dominated by Jerusalem municipal rubbish dumps. All 257 families in the five villages have been issued with demolition orders for their homes.

"All the village, not just the school, is unauthorised," said Lt Col Ofer Mey-Tal of the Israeli Civil Administration. "These people don't own the land, they just took it. So the village itself is a problem, and the solution is for it to move."

He said the authorities would not demolish the school over the summer, or at any time before the village was relocated. "We're not going to destroy the school. We like the school, but it's not authorised."

The Bedouin villagers are resisting relocation. "I was born here, I've spent most of my life here, and I want to stay here," Hamis says.

Back in the tyre and mud school, Hanan Awad is hoping the summer holidays will pass without the appearance of the bulldozers. She is proud of the school. "It's unique," she says.

"We are not thinking about demolition," she insists. "If we keep thinking about it, we won't be able to get on with our jobs."

The teachers try not to discuss politics or the threat of demolition in class, she adds. Despite their difficult living conditions and bleak economic prospects "the children are happy. They just want to learn".