When Linda Tempest heard the news that one of her pupils had been arrested, her first reaction was disbelief. "It came as a bit of a shock that anybody from the school could be implicated in something like that," she says. "I thought `That is not the boy I have known for five years'."
Hammaad Munshi, in Year 11, had been walking home from school after a science GCSE exam when he was picked up by police. They found two packets of ball-bearings in his pocket, but it was what they found on his computer that really interested them.
As well as an internet history that showed he spent hours surfing jihadist sites, he had downloaded files on how to make napalm, detonators and explosives. A note under his bed indicated that he wanted to die a martyr; his online profile was "fidadee", meaning a person ready to sacrifice himself. He had also been in email and telephone contact with a man believed to be the ringleader of a terrorist cell.
Just 16 when he was arrested in 2006, Munshi was 18 when he gained the dubious distinction of becoming Britain's youngest convicted terrorist, sentenced to two years for compiling information likely to be used for terrorist purposes. His trial heard that ball-bearings were commonly used as shrapnel for suicide bombers.
"He was a very quiet boy; he didn't really join in with many school activities," says Mrs Tempest, associate headteacher at Westborough High School in Dewsbury, West Yorkshire. "It made issues that were of national significance very local, very suddenly. It was a bit of a wake-up call."
It is rare for a school to discover that one of its pupils is a terrorist, but teachers are being asked to play a growing role on the frontline in combating extremism of all types. This may mean preventing pupils from becoming radicalised or identifying children at risk of falling under the sway of extremists.
There is a growing awareness that children can start on the wrong path while still at school. David Copeland, who was convicted in 2000 of murder after a 13-day bombing campaign in London - in Brixton, Brick Lane and Soho - that left three people dead and 126 injured, was thought to have developed a hatred for ethnic minorities while at Yately School in Hampshire, including refusing to play with an Asian boy in his class.
The Government's Preventing Violent Extremism (Prevent) strategy is a wide-ranging programme that aims to stop individuals becoming terrorists or supporting violent extremists. A key part of Prevent is to provide teachers with a toolkit to help them identify, and work with, any pupils they have concerns about. A report on the programme's progress late last year found that some schools had successfully followed this guidance to identify pupils who could be vulnerable to extremism.
In one instance, a girl at a school in the South East gave a class presentation about aspiring to join an extremist organisation, including graphic images of terrorist atrocities.
Teachers visited the girl's home, where the family reported that she had come under a negative outside influence. The school worked with police and community leaders to counter the negative messages.
In another, a teenage girl in the north of England was found to be being "groomed" by a man identified as a "radicaliser" she had met at a mosque. Violent images were found on her computer. A support plan involving police and her teachers was put in place and the "radicaliser" was investigated. Neither girl is now considered to be a concern.
The Government's toolkit, "Learning Together to be Safe", covers not just Islamic extremism but also Irish republican terror groups, animal-rights extremists and the BNP - in short, any pupils they fear may be at risk of radicalisation.
According to statistics from the police anti-terrorism project known as Channel, about 200 school pupils nationwide have been identified as potential violent extremists, including one aged seven. Yet there are concerns that schools have been slow to accept what the police and Government consider to be their responsibilities in this area.
A report by Her Majesty's Inspectorate of Constabulary (HMIC) last year said there were "low levels of recognition" of the risk, and the exchange of information with schools was "inconsistent" in one-third of police force areas.
The role of schools in combating extremism has a particular resonance in Dewsbury. As well as Hammaad Munshi, two other former Westborough pupils have been charged with terrorist offences, though both were acquitted. The town was also home to Mohammad Sidique Khan, believed to be the ringleader of the July 7 London bombers.
But Islamic extremism is not the only threat. The town elected a BNP councillor in 2006 and in last year's European Parliament elections for the Kirklees constituency, which includes Dewsbury, the far-right party was placed fourth with 11.4 per cent of the vote.
But while it may have been a shock, Munshi's arrest and conviction have not derailed Westborough's efforts to counter extremism. Making sure every child is included and working closely with the local community is at the heart of the school's ethos.
"Combating extremism is in everything we do, but we don't think of extremism as the only issue; it is about inclusion for everybody," says Mrs Tempest, who is responsible for the school's work with the community.
A central plank of the school's approach is making sure no child is left out. In one scheme, a group of six Asian boys who were thought to be at risk of disaffection were encouraged to take part in a project to put together a radio programme. Two of the boys are now involved in deciding where future funding for inclusion projects should be spent.
"We take quiet Asian boys to camp, we take them into youth clubs, we get to know them," Mrs Tempest says. "The more you get to know about children the less likely they are to turn to extremism."
The school's catchment area includes 13 mosques and Mrs Tempest has built close links with seven of them. English and maths teachers from Westborough run after-school classes at the mosques, and all new staff have a two-hour induction at a mosque. As a result, teachers can confront extremist views from a position of knowledge, she says.
"The school has worked very hard but the community has worked very hard with us," she adds.
Waseem Riaz, of Kirklees Faith Network, says the links have helped promote a greater understanding of Islam among teachers. "It is about myth-busting and making sure staff are sensitive to their pupils," he says. An awareness among staff of issues such as removing shoes or covering heads when visiting Muslim homes helps promote a positive attitude in the community towards the school, he adds.
Zara, a Year 11 pupil at Westborough, says the link between the school and mosque provides reassurance to parents. "They know the teachers are not just here for us in the six hours we are at school but they are going out into the community. It gives them a real sense of security," she says.
Westborough also encourages parents to get involved with the school, through English classes, keep-fit and sports activities and regular contact. As a result, parents' evenings have a 95 per cent turn-out. "It is about breaking down barriers," says Gayna Goalby, Westborough's extended schools co-ordinator.
Akbar Rasool is one of a number of former pupils who visit the school to talk to pupils. Mr Rasool, a solicitor in the town, provides a role model for Asian children. "I was born in the community, I have lived here all my life and I understand what the issues are," he says.
Year 9 pupils all undertake a week's work in the community and the school aims to ensure that white children spend it in Asian areas, and Asian children in white areas. The school council is made up of a white boy and girl and an Asian boy and girl.
This approach has been built into the curriculum, and not just for citizenship or PSHE classes. All Year 11 pupils study Harper Lee's classic novel To Kill a Mockingbird, with its message of confronting prejudice, in English classes. History includes a module on Moghul India, presented as an example of an empire other than the British Empire.
Janet Pruchniewicz, headteacher at Westborough, where 70 per cent of pupils are of Asian origin, believes that some schools have been reluctant to embrace this aspect of their statutory duty. "We're very proud of the work we have done on community cohesion and we feel that a lot of schools can learn from us," she says.
While there may be concerns that some schools have been slow to pick up on the Prevent agenda, one school singled out for praise by ministers is Highcrest Community School in High Wycombe, Buckinghamshire. While the school has not had any incidents with pupils, the town has its own place on the map of Britain's home-grown terrorists. High Wycombe was the home of Assad Sarwar, who in September last year was convicted of his role in a plot to blow up at least 10 transatlantic airliners in 2006.
Headteacher Shena Moynihan says promoting links with the community is a key part of the school's ethos, with about half its pupils from ethnic minorities. Projects include workshops for Muslim women, partnerships with schools in India, Africa and the Caribbean, and an annual carnival where all the school's 34 ethnic groups are represented.
"We can only prevent extremism if we can get pupils to embrace their community and make them feel they have a stake in it," says Ms Moynihan. "If they do that they are not likely to go down the radicalised route."
She believes raising aspirations is an effective way of preventing one group from feeling alienated. "It's very important that you give each child a sense of connecting at an early age," she adds. It is also important to involve the whole school community, she says: focusing on one group risks fragmentation.
Teachers in Derby have also been involved in attempts to identify potential extremists, in conjunction with the city's mosques and imams. Concerns raised in schools trigger a formal mechanism under safeguarding procedures, says Angela Cole, head of schools and learning at Derby City Council. Children will usually be seen by the city's behaviour panels, who can then refer them on to specialist agencies. A graduated response depends on the nature of the concern, she adds.
There have been fears, however, that the role of schools in identifying prospective terrorists involves collecting information on people who are not involved in criminal activity. Liberty, the civil rights campaign group, has described the Prevent agenda as the biggest modern spying programme in Britain. The Institute of Race Relations has also expressed concerns about the impact of monitoring on Muslim communities.
Westborough has been determined to confront the issues raised by a pupil's terrorist conviction. The morning after Munshi's arrest Mrs Tempest asked all form tutors to discuss the issue with their forms. "We don't push these issues under the carpet," she says.
This open approach is a crucial part of preventing young people from moving towards extremism, says Toaha Qureshi, chief executive of Stockwell Green Community Services in south London, and one of the first to set up counter-radicalisation programmes for Islamic extremists in Europe.
"Schools need to encourage positive and healthy debate so young people can find a safe space where they can channel their anger and frustration. If they express themselves and feel they are being heard it gives them a sense of satisfaction," he says. "We don't want them to think there is nobody on their side."
Zara, whose mother is one of the women receiving English lessons at Westborough School, says the school helps parents "understand the way the community works".
Asma, a Year 11 pupil at Westborough, says the opportunity to take part in interfaith activities at the school, such as a recent video project, promotes understanding between different cultures and religions. It is when people are young, she says, that it is easier to influence their views.
This can work both ways, of course. Shahzad Hussain, learning mentor at the school, says some Asian boys can appear more vulnerable than others. But it is important to treat them the same as everybody else. "They are shy and can be manipulated so we try to get them involved in something," he says, adding: "There is no difference between the Asian boys and the white working-class boys: they all need attention."
Although teachers at Westborough are aware of the potential risk, Mrs Tempest says the school's work is not about spotting budding extremists. "We don't ever say to people `Look out for the child who sits looking surly and doesn't engage in class discussions.' There isn't such a person and you can't stereotype," she says.
"It isn't about finding individual children and thinking that they might be terrorists. It is about getting out into the community and making people happy to live in their community."
She believes that it is at times of transition that people can be most vulnerable, which perhaps explains why many pupils fall under the spell of terrorist groups when they leave behind the security of school and go on to college or university.
Where there are concerns over an individual child, Mrs Tempest says the nature of the issue dictates the response. Children may be unaware of the meanings or symbolism of particular phrases or images, but if there are concerns then the pupil's parents could be asked to come in to discuss what has happened, or they could be referred to the Channel project, which combines community groups and anti-terrorism police.
S ome school referrals end up with Mr Qureshi in south London. Depending on where the individual lies on the spectrum of disaffection and alienation to convicted terrorist, a tailored programme is drawn up, lasting between 18 and 36 months. This can include religious and social mentoring, education and training opportunities, involvement in sport, and anger and stress management and empowerment techniques.
"We are very proud of the work we do," says Mrs Tempest. "But that doesn't mean there are never going to be any problems." For Zara, it is a question of overcoming the barriers between different communities. "There is just this big wall of prejudice that everybody has to get over," she says. It may be one more responsibility on already over-loaded schools, but combating extremism is one that has to be taken seriously.