Giving evidence, Mr Taylor said: "I burst into the gym. It was a scene of unimaginable carnage. It was one's worst nightmare. The air seemed to be thick with bluish smoke and the smell of cordite was quite strong."
It emerged that after Hamilton, 43, had sprayed the five and six-year-olds with bullets, he walked up to where the helpless injured lay, stood over the tiny bodies and shot them at point-blank range, one by one. Some children were shot as many as seven times.
Mr Taylor, 45, said he heard banging and thought at first there were builders in the school. He was alerted to the shooting by his deputy head Agnes Awlson, who ran into his office in a crouched position, afraid that there might be more than one gunman. He dialled 999 immediately.
The inquiry heard of the courage of the teachers and ancillary staff who rushed to tend the injured and dying, before the emergency services arrived.
The day before the killings, the school had received a copy of a letter sent by Hamilton to the Queen protesting that he had been unfairly labelled a pervert by councils, police, schools and the Scouts Association. A number of similar letters had been received in the past, Mr Taylor said.
Detective chief superintendent John Ogg revealed that Hamilton had entered via a side door leading into the assembly hall, one of six entrances to the school.
Mr Taylor said that since March 13 security has tightened and communication improved. There are now 45 phone lines and senior teachers have mobile phones. A single-entry system is being introduced and closed-circuit TV has been installed with links to the police station. A community policeman guards the entrance and emergency doors are alarmed. Five parent-helpers who have been vetted supervise playtimes.
Mr Taylor said he thought the measures were essential under the circumstances. He urged all schools to "actively pursue" their own security. Asked if the fortress mentality detracted from the atmosphere a primary school would wish to promote, Mr Taylor said: "It may do, but there are greater considerations now. I think all schools throughout the land have suffered because of what happened here. It may well be that the experience [we have] gained with new security systems will be made available to other schools."
He added that all adults working with children should be subject to strict vetting and screening for criminal records.
He finished one hour and 15 minutes of evidence by saying that the school was recovering. "Children are remarkably resilient and are coping remarkably well and so are the staff. But it has been difficult and continues to be difficult. "