Ten years ago come Monday, on March 13, a man walked into the gym hall of Dunblane Primary and took just three minutes to gun down the P1 class, killing 16 of the 5- and 6-year-olds and their class teacher, Gwen Mayor, aged 45. Another 12 pupils, the part-time PE teacher and the special needs assistant were injured.
It was a Wednesday, shortly after 9.30am. The malicious act tore through any sense of peace and security in Scotland's schools and heralded a world where the most extreme of horrors was conceivable.
The school remained closed for nine days as those united in grief tried to come to terms with the catastrophe. It reopened on Friday, March 22, after the last three funerals the day before.
There was little time for reflection in the school. In the days, weeks and months that followed, it had to play a crucial role in the community's recovery, despite the shock and upset affecting staff. Teachers had to be on hand to comfort and inform others and, more importantly, to help regain a sense of normality.
The consequences of Thomas Hamilton's actions reverberated throughout the UK for months. A rethink of school security was instigated to make them safe yet accessible; new procedures were put in place to vet and supervise those who work with children; and the banning of privately-owned handguns came into force two years after the tragedy.
On a less public level, the experiences of Dunblane had a profound influence on the way schools and local authorities deal with the sudden and unexpected death of a pupil or pupils. Local authorities realised that a careful, sensitive and well-formulated response could help friends, relatives and teachers who had known the child or children who had died.
"The Dunblane incident was a tremendous shock for everyone," says Alan Haughey, principal psychologist with Midlothian Council. "Lots of councils learned from what happened there. Our own crisis management document makes specific mention of the work done by Stirling."
Every local authority has developed a similar protocol which is invoked in times of tragedy. Training sessions are encouraged, with practice runs on what schools should do if a pupil dies or is killed.
"It is good practice for schools and other agencies to test their plans, as a desktop exercise or as a simulation," says Douglas Thomson, principal psychologist at Edinburgh City Council. "Schools should plan for worst-case scenarios."
The death of a child, at school or, more commonly, outside school, can have ramifications beyond the immediate class. Pupils and teachers need time and space to reflect and come to terms with tragedy and local authorities need to respond immediately to protect them from unwanted attention and support them.
Midlothian had to invoke its crisis management protocol last year during the trial of Luke Mitchell, a pupil at St David's High in Dalkeith, who was jailed for 20 years for murdering his girlfriend, Jodi Jones, 14, in 2003.
One of the key roles of a local authority in a sudden death incident, even when the death occurred years previously, is to ensure good press relations, with a stream of information for the newspapers. Even so, some journalists will go out of their way to get a newer, fresher angle for their papers, including sneaking into a school, which was something St David's High had to deal with, despite its efficient security system.
"What often shocks people is the less-than-professional journalists who use nefarious means to interview young people for stories from behind the scenes," says Mr Haughey. "And this is despite regular press conferences and press releases. They always want more."
It doesn't have to be murder to attract the media's attention. Suicide, road accidents, death in a fire can all bring unscrupulous hacks rushing to the school gates.
At another Midlothian school, a reporter was found wandering through the building after a press conference about a child killed in a fire. He was escorted from the premises.
Stephen Iliffe, Highland's senior manager in charge of additional support needs, says: "At my previous authority, we had an incident where journalists were hiding in the trees and trying to climb through to the school to interview teachers and pupils. This can be very upsetting for people already affected by the death of a pupil or peer and it is the role of the local authority to protect them."
It can also have a detrimental effect on the running of the school.
"It is very difficulty to regain a sense of normality when the school is besieged by the media," adds Mr Thomson. "Yet it is essential to get things back to as close to normal as possible. Schools shouldn't be closed and teachers must carry on teaching."
Often the gut reaction is to close any school affected, especially if there is a police investigation, but that can do more harm than good. Educational psychologists advise against it, unless there are cogent reasons, such as there were in Dunblane.
"The continued life of the school maintains normality," says Mr Haughey.
"It gives pupils and teachers a sense of security, which they need after traumatic events."
But those schools that have been affected by tragedy know it is impossible to carry on as if nothing has happened. Few teachers or pupils could.
Mourning is an essential part of coming to terms with what has happened and schools will often burn candles or open a book of remembrance.
Talking about the death at assembly, to inform and comfort, is advised in many local authority policy documents, as long as it is honest and in language that all pupils understand. It can take some of the strain off class teachers, who may have been as traumatised by events as pupils and find talking about it difficult.
Having someone at school to talk to distressed pupils can help and most local authorities will despatch a support team, including educational psychologists. Although it is not within their remit, many will also make time to talk to upset teachers.
"It is good practice to have somewhere for students to go, but they shouldn't be left on their own," says Mr Thomson. "Being encouraged to talk can help work through issues, but someone should be there at all times to ensure the focus of any discussion is kept within the bounds of reality.
"There should also be somewhere for the staff to go, where they can talk or just have a few moments of silence."
Boroughmuir High, in Edinburgh, recently experienced the death of 16-year-old Andrew Morrison through suicide. The senior management team allocated a vacant classroom where upset pupils could go for comfort.
Teachers and local authorities also have to be aware of the ripple effect of any tragedy. Friends and siblings of a pupil may attend other schools, while the death of a local child will disturb all parents in the vicinity, especially if it was violent.
"We learned this from an incident where a child died in a fire," says Mr Haughey. "Local authorities have to make all schools aware of incidents and that there may be pupils within their school who knew the child who died and are affected by the tragedy."
Helping people with closure is another crucial element of crisis management. A funeral is one way for pupils and teachers to find closure and teachers are advised to encourage pupils to attend if they wish.
"When a child dies suddenly, there is a sense of disbelief, which is why it is important to have some sort of symbol that this is reality," says Bernadette Cairns, the principal psychologist in Highland, which had to cope in November 2002 with the death of 5-year-old Danielle Reid, who was murdered by her mother's boyfriend and dumped into an Inverness canal in a suitcase.
"Schools should hold memorial services within school and older pupils and those from the class of the child should be given leave to attend the funeral," she advises.
Since Dunblane, there has been increasing understanding of how teachers can be affected by sudden death incidents.
"Teachers are in a different position from other professions or jobs, especially in primary schools, because of their relationship and proximity to the children for five days a week. It means the death of a child can have a major impact on that teacher," says Ronnie Smith, general secretary of the Educational Institute of Scotland.
Yet, their position as a symbol of security and safety means that they are important in keeping things going. They are also in a vital position to observe and monitor pupils' reactions and to notice who is not coping.
It means a lot of responsibility and pressure at a time when they themselves may be feeling highly emotional, and yet the policy of keeping a school open allows them little chance of relief.
"There can be immediate and long-term effects on teachers. Guilt and blame can often arise from tragedies, especially involving suicide," says Mr Iliffe. "Teachers have to accept situations and not blame themselves, but that can be hard."
The stress of such a situation can also trigger issues related to other bereavements teachers may have suffered in the past, which headteachers must treat sensitively. One of the greatest dangers is delayed trauma, which can be the result of not dealing appropriately with tragedy because of the demands of supporting others.
"There can be shock in the short term, but the trauma can be delayed and only manifest itself weeks or months later through disturbed sleep, flashbacks or nightmares," says Mr Haughey. "It is essential that headteachers are able to recognise this and that the teacher is encouraged to seek help from their GP."
Following Dunblane, GPs and headteachers have become better equipped to recognise symptoms of stress in teachers, while local authorities have become better placed to deal with crisis in schools.
The inquiry into the massacre found that no one could have foreseen the madness of Hamilton, but local authorities have been able to learn from the devastation he wrought. Now, at least, when there are incidents of sudden death, they have policies in place to help schools support everyone.