Ahamed Aathill Mohamed Samsudeen was under constant surveillance.
Since his release from prison in July, members of the police special tactics group had been watching his every move.
Last Friday afternoon, they followed him as he left the West Auckland mosque where he lived, boarded a train and went to the Countdown supermarket in LynnMall.
"There was nothing unusual about the subject's routine," Police Commissioner Andrew Coster said.
When Samsudeen arrived, he took a shopping trolley and for about 10 minutes, it seemed like every other visit he had made to the supermarket before that.
The surveillance team tracked him as closely as they could as he moved through the aisles, Coster said.
But at some point, he picked up a knife.
In a frenzied attack, he stabbed several people, injuring some of them critically. Shoppers fled the mall panicked and screaming.
Within a couple of minutes, Samsudeen was dead, shot by one of the police surveillance team.
What transpired was a terrorist attack, Prime Minister Jacinda Ardern said that evening.
But it did not come without warning.
Samsudeen, a Tamil Muslim from Sri Lanka, arrived in New Zealand on a student visa in 2011.
In 2013, he was granted refugee status.
But it was not until 2016 that Samsudeen came to the attention of both police and the Security Intelligence Service.
He received two formal warnings by police for posting violent, extremist, pro-Islamic State content online.
Undeterred by the warning, he used aliases to continue posting similar material.
A year later, in May 2017, he was arrested at Auckland Airport.
It was suspected he was on his way to Syria - he had previously told a worshipper at an Auckland mosque that he wanted to fight for Islamic State.
When police searched his apartment, they found a large hunting knife under a mattress on the floor.
They also found secure digital cards containing fundamentalist material including propaganda videos, photographs of him posing with a firearms, and bookmarks to sales of firearms, crossbows, binoculars, military boots and a vest.
Police charged him and he was remanded in custody.
In the courts
In June 2018, in the High Court at Auckland, Samsudeen pleaded guilty to representative charges of knowingly distributing restricted publications.
Police withdrew an offensive weapon charge in relation to the hunting knife.
By that time, he had been held in custody for 13 months - far longer than any prison sentence for the charges he faced.
He was granted bail by Justice Wylie, pending his sentencing, with strict conditions around his use of electronic devices and the internet.
But in August 2018, Samsudeen breached those conditions.
He searched the internet for camouflaged trousers, as well as his own name, news stories about his offending and "ISIS allegiance".
He then went and bought the same model of hunting knife police had earlier found under his mattress, with a camouflaged sheath.
Samsudeen was arrested again and his room was searched.
That time, on his electronic devices, police found he had searched the internet for "enemies of Allah", "hunting knife" and "Islamic State dress".
He had also been accessing Islamic State hymns and videos, many of which depicted violent acts. One referred to "how to kill non-Muslims".
He was charged by police and remanded, once again, in custody.
More prison time not an option
In September 2018, Samsudeen was sentenced on the first set of charges to one year of supervision.
Justice Wylie concluded a prison term could not be imposed, given the lengthy amount of time he had already spent in custody on remand.
Special conditions were imposed, restricting Samsudeen's use of electronic devices and the internet, and he was required to attend psychological assessments and rehabilitation programmes.
But Samsudeen appeared to exhibit a clear disregard for authority.
"The probation officer who interviewed you for the pre-sentence report advised that you have an isolated lifestyle, a high sense of entitlement and a propensity for violence," Justice Wylie said in his sentencing notes.
"He commented that you show minimal insight into your offending, that you believe that the charges to which you have pleaded guilty are 'fake'."
Because Samsudeen had been remanded in custody on the second set of charges, he remained in prison awaiting his trial.
Terror charge denied
The Crown had wanted to charge Samsudeen under the Terrorism Suppression Act, alleging he was planning to carry out a terrorist act.
But in July 2020, Justice Downs ruled that was not an offence under the law.
In his decision, he said: "Terrorism is a great evil. 'Lone wolf' terrorist attacks with knives and other makeshift weapons, such as cars or trucks, are far from unheard of.
"Recent events in Christchurch demonstrate New Zealand should not be complacent. Some among us are prepared to use lethal violence for ideological, political or religious causes.
"The absence of an offence of planning or preparing a terrorist act ... could be an Achilles' heel."
Justice Downs said it was not for the courts to create such an offence.
"The issue is for Parliament," he said.
A copy of Justice Downs' judgment was provided to the Attorney-General, the Solicitor-General and the Law Commission.
High Court trial
Samsudeen finally stood trial in the High Court at Auckland in May this year.
A jury found him guilty of two charges of possessing Isis propaganda that promoted terrorism and one charge of failing to comply with a search.
He was acquitted of a third charge of possessing objectionable material and a charge of possessing a knife in a public place.
He was sentenced in July.
Justice Fitzgerald did not accept Samsudeen's explanation that he was listening to Islamic State 'nasheeds' - hymns - to improve his Arabic language skills.
"Rather, I accept that the broader context to your possession of these nasheeds, which included a range of other materials relating to Isis or Isil, suggests that you have an operative interest in Isis.
"In other words, I do not accept that you might have simply stumbled across these and other Isis-related materials in your research of Islam or the historic Islamic State," she said.
A pre-sentencing report raised further flags.
"The report writer suggests that you support the goals and methods of Isis," Justice Fitzgerald said.
"The report writer concludes that the risk of you reoffending in a similar way to the present charges is high.
"It suggests that you have the means and motivation to commit violent acts in the community and, despite not having violently offended to date, as posing a very high risk of harm to others."
Given he had already spent three years in prison awaiting trial, a further term of imprisonment was not an option.
The Crown said the maximum penalty for the offending would be a seven-month prison sentence, which had already been far exceeded by the time he was in custody on remand.
Justice Fitzgerald sentenced Samsudeen to one year of supervision, with restrictions on his use of electronic devices, the internet and social media.
"The Police and Community Corrections clearly have concerns that you pose a not insignificant risk to the broader community," Justice Fitzgerald said in her sentencing notes.
"I do not know whether those concerns are right and I sincerely hope that they are not, though having regard to all of the materials available to the court, I can say that they are not wholly fanciful."