Jacinda Ardern says her government tried frustratingly for three years to deport the Auckland supermarket terrorist from New Zealand.
The 32-year-old Sri Lankan national responsible for Friday's shocking knife attack was named on Saturday night as Ahamed Aathill Mohamed Samsudeen after the lapsing of court-mandated suppression orders.
He injured seven people in the stabbing.
As of Sunday afternoon, three remain in hospital in a critical but stable condition, one is stable in hospital, and three others are recovering at home.
Samsudeen spent a decade in NZ, arriving in 2011 on a student visa.
Only now, with the lapsing of court orders, can it be revealed that he remained in the country courtesy of his refugee status, granted in 2013.
That refugee claim was contested during the entirety of his stay.
Immigration NZ refused his initial application in 2011, but the Tamil Muslim was approved on appeal by the Immigration and Protection Tribunal in 2013 after he argued his fear of persecution on return to Sri Lanka.
When Samsudeen came to police attention in 2016 for expressing sympathy for terrorism on Facebook, Ms Ardern said an investigation into the man's refugee application began.
"In the course of these investigations, Immigration New Zealand were made aware of information that led them to believe the individual's refugee status was fraudulently obtained," she said.
"The process was started to cancel his refugee status, and with it, his right to stay in New Zealand."
Officials found Samsudeen had fabricated documents in his application.
Despite the wrongdoing and the concern of security officials, efforts to strip his residency rights and deport him were stymied.
It was not until February 2019 that Immigration NZ cancelled Samsudeen's refugee status, when he was already in prison facing criminal charges.
The government had to wait until those criminal charges were dealt with, in May this year.
"Immigration New Zealand explored whether the Immigration Act might allow them to detain the individual while his deportation appeal was heard," Ms Ardern said.
"It was incredibly disappointing and frustrating when legal advice came back to say this wasn't an option."
In July, Crown Law issued advice Samsudeen would qualify as a "protected person" under the Immigration Act, making his deportation legally difficult.
On that basis, the government reluctantly accepted his right to be in the community, and police began a highly-resourced surveillance operation.
The prime minister said she was concerned "the law could allow someone to remain here who obtained their immigration status fraudulently and posed a threat to our national security".
"Immigration New Zealand from the beginning have sought to deport this individual, and were right to do so," she said.
Now, Ms Ardern is focused on updating NZ's counter-terror laws, pledging to do so by month's end.
The government already has laws in parliament to enhance anti-terror laws, which it built following the the 2019 Christchurch Mosques massacre.
Legal experts have cautioned against rushing through crucial legislation without careful oversight but on Sunday, Deputy Prime Minister Grant Robertson pledged "they will be ready".
"We want to expedite the process but we also want to make sure we get the law right. There are a number of weeks to go in September," he said.
Australian Associated Press
Sign up for our newsletter to stay up to date.