New Zealand had been trying for years to deport an ISIS-inspired radical who went on a frenzied stabbing attack, Prime Minister Jacinda Ardern has revealed.
She said it was frustrating that he was allowed to stay free.
The lifting of suppression orders showed the attacker, Sri Lankan Ahamed Samsudeen, was served a deportation notice in April 2019 after his refugee status was revoked.
While the legal process dragged on, Samsudeen grabbed a knife off a supermarket shelf in Auckland on Friday and injured seven people, leaving three critically wounded, before he was shot dead by police who were tailing him.
Ms Ardern, who referred to Samsudeen as "the terrorist" and did not mention his name, was able to outline steps New Zealand had taken to try to deport him after the legal suppressions were removed on Saturday.
Samsudeen arrived in New Zealand as a 22-year-old in 2011 on a student visa and was granted refugee status two years later.
In 2016, he came to the attention of the police and intelligence agencies after expressing sympathy on Facebook for terrorist attacks.
During their investigations it became evident the refugee status was fraudulently obtained and the process began to cancel his right to stay in New Zealand, Ms Ardern said.
The following year he was arrested at Auckland Airport, when it was suspected he was on his way to Syria and a police search of his home had revealed a large hunting knife and "material related to ISIS propaganda", court documents said.
Ms Ardern said deportation notices were served in April 2019.
Samsudeen, who described himself as a Tamil Muslim, appealed against the deportation and told a court he faced "arrest, detention, mistreatment and torture" if sent back to Sri Lanka.
"He was still in prison at this time, and facing criminal charges. For a number of reasons, the deportation appeal could not proceed until after the conclusion of the criminal trial in May 2021," Ms Ardern said.
"In the meantime, agencies were concerned about the risk this individual posed to the community."
She said officials knew he could be released and that the appeal, "which was stopping his deportation, may take some time".
The country's immigration agency looked into ways of detaining Samsudeen during the appeal process through the Immigration Act, Ms Ardern said.
"It was incredibly disappointing and frustrating when legal advice came back to say this wasn't an option," she said.
Samsudeen at that stage had been held in custody for three years and authorities had exhausted all avenues to keep him detained.
Attempts to have him charged under New Zealand's Terrorism Suppression Act were unsuccessful and Ms Ardern said changes to New Zealand's counter-terrorism legislation were expected to be approved by parliament before the end of the month.
"In late August, officials including the commissioner of police raised the possibility of expediting the amendments," she said.
Police commissioner Andrew Coster said there had been nothing unusual about the man's actions in the lead up to the attack, and he had appeared to be doing normal grocery shopping.
Because he had a "high level of paranoia" around surveillance, Mr Coster said the police kept their distance, and it took more than two minutes to reach the man and shoot him after he started his stabbing spree.
The day after the attack, Sri Lankan authorities said they would co-operate with New Zealand's investigation "in any way necessary", Foreign Ministry spokesman Kohularangan Ratnasingam said.
Sri Lankan police sources said criminal investigators had already interviewed the attacker's brother, who lives in the capital Colombo.
"We are collecting information about him as well as anyone else who may have had contacts with him," a senior police official said.
In an interview on Saturday, Samsudeen's mother said her son had been brainwashed by neighbours, who she said came from Syria and Iraq.
"We knew there was a change in him," she told Hiru TV from her home in Kattankudy, east of Colombo.
Sri Lanka's Muslim Council has condemned the Auckland attack as a "barbaric act of terrorism".
"This reminds all of us to come together and be united and fight against terrorism and violent extremism," council member Mohamed Hisham told AFP.
Sri Lankan Muslim politician Mujibur Rahman said his community was saddened by the attack, while lauding Ms Ardern for easing public tension.
"Her [Ms Ardern's] statement soon after the incident defused the situation and ensured there was no harm to the Sri Lankan community [in New Zealand]," Mr Rahman told AFP.
Ms Ardern said no one community should be singled out over the violence.
"It was carried out by an individual, not a faith, not a culture, not an ethnicity," she said.