A deadly cocktail of deepening resentment against Dunblane parents, serious financial difficulties and emotional instability appears to have propelled Thomas Hamilton to wreak the murderous revenge which led him to shoot dead 16 pupils and their teacher on March 13, 1996, before turning the gun on himself in the gym of the local primary school.
Statements from witnesses, with their identities blanked out, were among 3,000 documents relating to the Dunblane massacre made public on Monday for the first time. These included hundreds of letters Hamilton fired off to bodies such as the police, local councils, politicians - and even the Queen - from the mid-1970s to the mid-1990s.
The papers also reveal chilling accounts of the scene in the gym from the PE teacher who survived being shot by Hamilton and from the headteacher.
The documents, from the Cullen inquiry, had been placed under a 100-year closure order. Lord Advocate Colin Boyd, Scotland's senior law officer, reviewed that decision and the papers were made available at the National Archives of Scotland in Edinburgh.
One person who had known Hamilton for years told police that he would regularly vent his grievances in telephone calls, including one on the night before the massacre. "I would say he did have a thing, almost paranoia, about the scouts, police and parents in Dunblane," the witness told police.
Hamilton was known to the police and organisations in central Scotland where he ran boys' clubs. Allegations about his homosexuality were said to have added to his agitation. The witness visited Hamilton at his home several times and noted that there were photographs of young boys doing press-ups and other exercises on the living-room walls.
The message from the disclosed papers is one of a series of blunders and inaction by several agencies over many years, despite constant warnings.
Twelve days before the shooting, the headteacher of Thomas Muir High in Bishopbriggs, near Glasgow, reported to her education authority that Hamilton had shown a gun to a boy attending a football club he ran at the school.
She was advised to contact a senior social worker who passed the information to a colleague who was off ill at the time. On Monday, March 11 - two days before the tragedy - the social worker returned to work and read the letter, "but did not appear to digest the contents in full".
The same day the headteacher phoned the senior social worker to "express her dissatisfaction and concern" that no action had been taken.
As early as 1992, Hamilton came to the attention of child welfare agencies after two boys ran away from a summer camp he ran at Dunblane High. They were found late one night sitting on a pavement in their pyjamas. The reporter to the children's panel wrote to the local council and the police:
"I fear that a tragedy to a child or children is almost waiting to happen."
Other allegations from parents about Hamilton's youth camps led to a police investigation in 1993. An unnamed detective constable in the child protection unit at Bannockburn, Stirlingshire, said: "Mr Hamilton has undoubtedly sailed very close to the wind for many years as regards the inappropriateness of his methods of alleged tuition of very young, immature and unsuspecting boys of primary school age."
The police drew up a list of 10 possible charges but the procurator fiscal in Stirling, the prosecuting authority, decided there was insufficient evidence.
Hamilton was deep in debt at the time of the massacre, according to financial documents made public. The day of the massacre was the final deadline set for him to pay his council tax arrears, according to a financial analysis prepared for the Cullen inquiry.
The papers also reveal a written statement from Eileen Harrild, a PE teacher at Dunblane primary, who survived Hamilton's attack. "He walked straight towards me. He did not pause or speak. He just continued walking straight towards me, looking at me and shot me."
Ron Taylor, the headteacher at the time, told of arriving in the gym after the shooting stopped and finding Gwen Mayor, the class teacher, lying dead at his feet. "There was a young child whom I recognised . . . lying immediately beside her and partly on top of her."
Hamilton's body at this stage was lying on the floor but his right hand was twitching, Mr Taylor stated. Despite the danger, John Currie, the janitor, "continued to walk towards him and kicked one gun away from Hamilton, then picked up another gun and threw it away".
Mr Taylor ran to get paper towels to staunch the flow of blood from the wounded children. One girl had serious injuries. "She died while I held her." He then found a boy with a serious wound to the head who was obviously about to die. "I apologised to him and moved away," Mr Taylor said.
There was a grim discovery for police at Hamilton's house - a phone book lay open at the page where Dunblane primary school was listed.