The government spent more than four years trying to deport the man responsible for the west Auckland supermarket terrorist attack.
But repeated attempts to have him stripped of his refugee status were ultimately unsuccessful, hamstrung by what Prime Minister Jacinda Ardern has called a "frustrating process".
Last night, suppression orders that prevented the publication of details about the terrorist's identity, background and immigration status lapsed.
It can also be revealed immigration authorities were trying to have his refugee status revoked, because it was believed it was fraudulently obtained.
But Samsudeen himself had claimed in the courts that he could be arrested, detained, mistreated or tortured if he was ever sent back to Sri Lanka.
The terrorist's refugee status
Samsudeen was a Tamil Muslim. He left Sri Lanka, arriving in New Zealand on a student visa in 2011.
He sought refugee status, saying he and his father experienced serious problems with the Sri Lankan authorities due to their political background.
His initial application was declined in 2012, because Immigration New Zealand found his claim lacked credibility.
An appeal was lodged, and Samsudeen was recognised as a refugee by the Immigration and Protection Tribunal in December 2013.
But in May 2018 he was notified that authorities wanted to revoke his refugee status, which would mean he would be deported.
Samsudeen appealed again.
He was already on the radar of the police and the Security Intelligence Service - he had received a formal warning in 2016 for posting violent, extremist, pro-Islamic State content online.
Ardern said it was over the course of those investigations that Immigration New Zealand was made aware of information that led them to believe Samsudeen's refugee status was fraudulently obtained.
At the time he was notified about the intention to revoke his refugee status, Samsudeen was before the courts.
He was arrested in 2017 at Auckland Airport, when it was suspected he was on his way to Syria.
When police searched his apartment, they found a large hunting knife under the mattress on the floor and secure digital cards containing fundamentalist material, including propaganda videos and photos of the man posing with a firearm.
Samsudeen ended up pleading guilty to distributing restricted publications and was sentenced on that offending in September 2018 to supervision.
In July 2018, he had been granted name suppression by Justice Wylie.
In his decision on that, Justice Wylie said Samsudeen said he "has been attacked, kidnapped and tortured, that he went into hiding in response to those incidents, and that he came to New Zealand in 2011 to seek refugee status".
Samsudeen told the court: "I'm very afraid of returning to Sri Lanka because I'm afraid of the authorities there and the same risks and fears [that] I had when I left my country are still there in Sri Lanka.
"Also young Tamil men face many serious problems in Sri Lanka from the authorities. We face arrest, detention, mistreatment and torture as we're always under suspicions by the authorities because of the [Liberation Tigers of Tamil Eelam]."
Justice Wylie said that there was a "real and appreciable possibility" that in the event Samsudeen did have his refugee status revoked and was deported, his safety could be in danger.
The involvement of the highest levels of government
Prime Minister Jacinda Ardern made inquiries about Samsudeen's refugee status and deportation options in May 2018. Yesterday she gave a media briefing which provided some more details on the man's situation.
In February 2019, Immigration New Zealand cancelled his refugee status and he was served with deportation liability notices.
But in April 2019, he appealed the decision to the Immigration Protection Tribunal.
At the time, he was remanded in custody, awaiting a High Court trial on a second set charges relating to offending committed while he was on bail for the first set of charges in August 2018.
He had been arrested after buying another hunting knife and a second search of his room found a large amount of violent Isis material.
Samsudeen's appeal against his deportation could not proceed until the conclusion of those court proceedings.
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.
After spending three years remanded in custody, Samsudeen was sentenced in July to 12 months' supervision.
In the meantime, Ardern said agencies were concerned about the risk Samsudeen posed to the community.
"They also knew he may be released from prison, and that his appeal through the Tribunal, which was stopping his deportation, may take some time."
Immigration New Zealand looked at whether the law would allow them to detain Samsudeen while his deportation appeal was heard.
"It was incredibly disappointing and frustrating when legal advice came back to say this wasn't an option," Ardern said.
Extensive police surveillance and monitoring of Samsudeen began as soon as he was released from prison.
On 26 August, Samsudeen's hearing in the Immigration and Protection Tribunal was rescheduled.
At the time of the terrorist attack, the question of whether or not he could be deported was unresolved.
"This has been a frustrating process," Ardern said.
"Since 2018, ministers have been seeking advice on our ability to deport this individual."
Ardern said in July this year she met with officials in person and expressed her concern that the law could allow someone to remain here, who obtained their immigration status fraudulently and posed a threat to national security.
"I asked for work to be undertaken to look at whether we should amend our law, in the context of our international obligations," she said.