He was Ahamed Aathil Mohamed Samsudeen, a 32-year-old born in Sri Lanka who came to New Zealand in October 2011 and was granted refugee status two years later.
It can now be revealed immigration officials had sought to revoke his refugee status in 2018, but he appealed and a final decision had yet to be made on whether he could be deported.
His uncertain immigration status was also the reason why the terrorist could not be identified until 11pm Saturday night, when it was lifted by a High Court judge, as anyone claiming refugee status cannot be identified by law.
Samsudeen was Tamil - a minority ethnic group persecuted by Sri Lankan authorities during a decades-long conflict - and claimed he and his father were attacked, kidnapped and tortured because of their political background.
His claim to asylum was supported by scars on his body, as well as a psychologist's report which said Samsudeen presented as a "highly distressed and damaged young man" suffering from post-traumatic stress disorder and depression.
"[The psychiatrist] believes it can only be explained in terms of traumatic experience, and she states that, in her opinion, it would be very difficult for him to have fabricated the degree of disturbance displayed during the interviews she conducted."
He was angry and worried about the safety of his parents, with his anxiety heightened by living so far away in a strange country, without the support of friends and family, and lacking confidence and maturity.
In other words, almost the perfect candidate to be radicalised in his living room.
A key strategy during the ascendancy and peak of Islamic State was using social media to radicalise those in Western countries.
Sophisticated social media centres targeted those considered by intelligence agencies to be most susceptible - disaffected young men, particularly those who felt isolated.
Such targeting was used to lure fighters to the Middle East and also to encourage those unable or unwilling, to carry out terror attacks in their home countries.
Samsudeen first came to the attention of New Zealand police on March 23, 2016, after he posted images of graphic acts of war violence on his Facebook account, with comments supporting the Islamic State bombing attacks in Brussels the day before.
He was given a formal warning by police, but now aware of their interest, set up several different Facebook accounts under aliases.
Officers from the National Security Investigations group monitored his social media content, which included anti-Western and violent imagery as well as this comment on Facebook: "One day I will go back to my country and I will find kiwi scums in my country ... and I will show them ... what will happen when you mess with S while I'm in their country. If you're tough in your country ... we are tougher in our country scums #payback."
He told a fellow worshipper at a mosque he planned to join Isis in Syria, and that if he were stopped from leaving, he would commit a random "lone wolf" style knife attack in New Zealand.
By this time, Samsudeen was now being watched closely under surveillance and on May 19, 2017, he was arrested at Auckland International Airport after booking a one-way ticket to Singapore.
A search of his apartment on Queen St found videos and songs espousing Isis extremism and imagery of sadistic violence.
There were also 24 images of Samsudeen posing with a long-barrelled air rifle and telescopic lens, and hidden under his mattress, a large hunting knife.
As a result, Justice Edwin Wylie had little choice but to sentence S to supervision on August 7, 2018, given the length of time he had already spent in custody on relatively minor charges.
The High Court judge also had no choice in granting a name suppression order to prevent Samsudeen from being identified.
A few weeks earlier, Samsudeen had been given notice that his refugee status would be revoked, meaning automatic deportation back to Sri Lanka.
He feared publication of his name would put his life in greater danger if he was sent back to his homeland.
"I'm very afraid of returning to Sri Lanka because I'm afraid of authorities there ... the same risks and fears [that] I had when I left my country are still there," Samsudeen wrote in an affidavit to the court.
Justice Wylie made an interim suppression order until his refugee status was determined.
A final decision had not yet been made but Justice Wylie lifted the suppression on Saturday night, given the significant public interest after the terrorist act in which at least five people were stabbed in the New Lynn Countdown supermarket on Friday.
Five of the six people taken to hospital had stab wounds, with three in critical condition.
Samsudeen - who was under 24/7 surveillance by police - was shot dead by members of the Special Tactics Group.
Because of the suppression order, the Prime Minister Jacinda Ardern and Police Commissioner Andrew Coster were unable to fully explain the circumstances as to why Samsudeen had not been deported or was even still in the country.
The Prime Minister promised to release more details on Sunday.
"We have utilised every legal and surveillance power available to us to keep people safe from this individual," Ardern said.
The Herald had previously revealed the police tried to charge Samsudeen for allegedly plotting a "lone wolf" style knife attack, but could not because of a longstanding gap in New Zealand's counter-terrorism law.
The attempted prosecution arose shortly after Samsudeen walked free from the High Court on the first set of charges.
The very next day, he went to a store to buy a new hunting knife - which Samsudeen asked to be couriered to his address - and went home.
The police were forced to arrest him again. Another search of his apartment found a large amount of violent material, including an Islamic State video about how to kill "non-believers" in which a masked man cut a prisoner's throat and wrists.
This time, prosecutors sought to charge Samsudeen under the Terrorism Suppression Act.
But a High Court judge ruled that preparing a terrorist attack was not in itself an offence under the legislation, which he said could be described as an "Achilles' heel" hindering the authorities' abilities to stop such would-be attackers.
Justice Matthew Downs acknowledged there was a serious threat to public safety from "lone wolf" attackers, especially after the Christchurch shootings that killed 51 people and injured 40.
But he dismissed the Crown's application to charge Samsudeen under the anti-terror law, saying it was for Parliament, not the courts, to create an offence of planning an attack.
The judgment, first reported by the Herald in August, was cited by government officials as one of the key events leading to the introduction of new anti-terror powers in April.
The judge's concerns were echoed by the Royal Commission of Inquiry into the Christchurch attacks when it presented its findings in November.
Labour's new Counter-Terrorism Legislation Bill, which passed its first reading in May, would make it a criminal offence to plan or prepare for a terrorist attack.
This afternoon, Prime Minister Jacinda Ardern said work was underway to change the law by the end of the month.
Samsudeen was instead prosecuted on lesser charges.
On May 26, he was found guilty by a jury of possessing propaganda-style material supportive of Islamic State. He was acquitted on other charges of possessing a graphic video depicting a prisoner being decapitated and possession of an offensive weapon.
In his own words when giving evidence at his trial, Samsudeen claimed he was interested only in the centuries-old Islamic State established by the prophet Muhammad and learning about his religion.
"You're worried about one knife, I am telling you I will buy 10 knives. It's about my rights," he said.
One of the nasheeds (hymns and chants) referenced martyrdom, featured a black-clad fighter with a machine gun, Isis flag, and lyrics advocating for jihad and decapitation.
The other, titled "We came to fill horror everywhere", depicts men dressed in black with assault rifles, the Isis flag and a city on fire.
"We will drink from the blood of disbelievers," the lyrics said.
In explanation for his offensive Islamic State material, Samsudeen compared the nasheeds to the haka.
"You guys have Māori war cries," he said.
Samsudeen was combative throughout the trial and had frequent outbursts in the courtroom, some directed towards Justice Sally Fitzgerald.
He said the Crown had wasted years of his life.
"I thank God, there have been prophets, other prophets who have been to prison," he said.
"It's just like a test … You guys put me in prison cause I'm a Muslim and you don't like my religion, that makes you an enemy. Allah says you will be punished."
According to a report prepared for his sentencing in July, Samsudeen has "the means and motivation to commit violence in the community". Despite police concerns about the threat to public safety, he was sentenced to one year of supervision.
At that point in time, Samsudeen was still in prison on two active charges for assaulting Corrections staff members while waiting for the High Court trial.
However, once the High Court case ended, Samsudeen was released on bail on July 16 by an Auckland District Court judge.
This was because the amount of time he had already spent in prison, if bail was denied, would be longer than the maximum sentence even if he was convicted of the assaults.
Since his release from prison, Samsudeen had been under 24/7 surveillance by police including members of the elite Special Tactics Group.
The undercover officers managed to stop him within minutes of his attack, where he took a knife from a supermarket shelf and stabbed nearby shoppers. Seven were injured, and three are in hospital in a critical condition.
Prime Minister Jacinda Ardern said the attack was carried out by an individual, not a faith, not a culture, not an ethnicity, but an individual person gripped by an ideology that is not supported here by anyone.
"This was a violent attack on innocent New Zealanders," said Ardern. "It was senseless."