On Oct. 14, 1981, Queen Elizabeth II stepped out of a Rolls-Royce in the New Zealand city of Dunedin to greet thousands of well-wishers in a routine royal walkabout—completely unaware that she had just survived an assassination attempt that came closer than any other to ending her life and radically altering the path of British history.

The queen, who was visiting New Zealand after a meeting of the Commonwealth leaders in Melbourne, Australia, had been shot at by teenager and self-styled terrorist Christopher John Lewis. Secret documents released this week reveal how embarrassed New Zealand authorities scrambled to cover up the assassination attempt, claiming the bang that rang out over the queen’s motorcade was simply a sign falling over.

Lewis was never charged with attempted murder or treason, and allegedly went on to murder after just three years in prison.

The documents, alongside investigative reporting by New Zealand news site Stuff, show the 17-year-old Lewis saw himself as the leader of a fictional National Imperial Guerrilla Army. He had a history of armed robbery, arson, and animal torture—and an apparent obsession with Charles Manson and Australian bandit Ned Kelly.

Lewis claimed he was instructed to “knock off” the queen by an imaginary accomplice that he only ever identified as “The Snowman,” and he became obsessed with wiping out the royal family.

On that October morning, Lewis, still a high school student, cycled to a seven-story building with his rifle wrapped up in a pair of old jeans and propped onto his handlebars. Inside the so-called Adams Building, chosen at the last minute for its clear view of the queen’s motorcade as it passed through the city, Lewis reached the fifth floor, put on a pair of gloves, leaned his rifle against an open window, and waited.

“My mind was in turmoil. I was tearing my insides out. I didn’t know what to do,” said Lewis in a later police interview. “I was going to make a spur-of-the-moment decision if I saw her.”

Five minutes later, Lewis spotted a Rolls-Royce coming down the street below him and readied himself. As the queen and her husband, the Duke of Edinburgh, stepped out in front of the Otago museum, the would-be assassin propped his .22 rifle on a windowsill—and fired.

“He was just about to pull the trigger. He was just tightening the trigger, he could just see her hat and was lining up the hat,” said a detective report. A police officer said: “If he had waited until she walked a wee bit closer... it could have been less than 50 meters.”

Lewis later claimed he had no clear sight of the queen when he fired and the shot was revealed in the declassified documents to have missed the royal party by a long way. The queen and the Duke of Edinburgh continued the meet-and-greet as if nothing had happened, unaware they’d just survived possibly the most serious security breach they would ever experience, despite the large crack that echoed overhead.

“The bullet’s trajectory was more likely to have passed high above the crowd than to have been fired at the road,” the report said. When reporters at the scene asked police what the noise was, they downplayed the incident saying it was merely a council sign falling over.

From there, the coverup snowballed.

After a tip to the British press from inside the royal court, police elaborated on their initial explanation by claiming that firecrackers had been let off nearby. Despite the public denials, police took Lewis into custody a week after the shooting in connection with an armed robbery and a connection was quickly made to the discarded rifle found in the Adams Building.

Classified police papers revealed that Lewis initially faced charges of treason or attempted treason, but they were significantly downgraded. “It is not intended to charge Lewis with anything more than unlawful possession/discharge of a firearm for this offense,” according to the police report.

The would-be assassin’s former lawyer, Murray Hanan, believes that a message had come from “up-top, politically” to downplay the incident, saying: “The fact an attempted assassination of the queen had taken place in New Zealand with a nutcase who later said he was trying to establish a new IRA movement... it was just too politically hot to handle.”

He added: “I think the government took the view that he is a bit nutty and has had a hard upbringing, so it won't be too harsh.”

Former Dunedin Police Detective Tom Lewis said the then prime minister, Robert Muldoon, feared the queen would never again visit New Zealand if word got out, telling Stuff: “Once you start to cover up, you then have to keep covering up the coverup.”

Allan Dick, former news editor of a local news station who worked in Dunedin at the time of the assassination attempt, said: “I have no doubt the matter was covered up, the cops were embarrassed, they didn’t want the media to know and we got embarrassed that we allowed ourselves to be snowballed to such a degree."

The official police summary only said that police were “satisfied that at no time could the accused have been close enough to the royal party to have been within effective range,” as part of its justification to not charge Lewis with attempted murder or attempted treason.

However, a secret document from 1997 confirmed Lewis’ intention to kill the queen, saying: “Lewis did indeed originally intend to assassinate the queen, however did not have a suitable vantage point from which to fire, nor a sufficiently high-powered rifle for the range from the target.”

Lewis was released from prison just three years after the attempt on the queen’s life in 1984. A declassified report states that police kept in daily contact with him during a royal visit in 1986, eventually sending the gunman to Great Barrier Island, off the country’s north coast, during the trip. “I had a great holiday,” Lewis later wrote.

Lewis would go on to rob banks, fake a passport, and, allegedly, finally carry out a murder. Lewis killed himself in his cell on Sept. 23, 1997, while awaiting trial for the killing of Tanya Furlan, a mother of three.