An investigation into the Australian federal agency in charge of ordering the detention of hundreds of New Zealanders has found massive shortcomings.
The National Character Consideration Centre (NCCC) was a decision-making unit in the Department of Immigration and Border Protection, and has since been absorbed into the Department of Home Affairs.
A scathing report by former inspector general of intelligence and security Vivienne Thom found the centre lacked basic quality controls over its decisions to cancel visas.
The review also found staff lacked the fundamental knowledge to perform duties and there was no assurance that decisions to cancel visas or detain people complied with policy or the law.
The report was completed internally last year and released under freedom of information laws to The Guardian Australia.
"Officers do not consistently demonstrate the requisite knowledge, understanding and skills to fairly and lawfully exercise the power to detain," Ms Thom said.
The federal government ordered the inquiry to find out what went wrong in the cases of two Australian citizens illegally detained last year.
One of them, a New Zealand citizen, was held for more than three months unlawfully.
Among the failings highlighted by the review was that officers ignored critical information about why the two should get their visas back.
It was "quite possible that other Australian citizens have been detained or removed in similar circumstances".
The NCCC has cancelled the visas of hundreds of New Zealanders who, because of a law change three years ago, have been automatically detained in immigration detention centres.
Those changes, which mean no-one gets to present their case before being detained, and government pressure to subsequently speed up detention processes, had increased the need for "strong checks and controls" on coercive powers, Dr Thom said.
Yet the NCCC had decreased the level of oversight of decisions to cancel visas.
Detainees' lawyers have been saying for a long time that New Zealanders are being thrown at the mercy of a system designed by the federal government to be increasingly unfair.
This investigation backs up previous internal reviews that found decision-making, systems, training and quality control in the immigration detention system were deficient.
The federal government told Dr Thom it was making changes to protect Australian citizens from being detained.
An Australian National Audit Office a year ago concluded there had been progress, but not enough, towards ensuring immigration officers exercised coercive powers lawfully and appropriately.
Absorbing the immigration department and the NCCC into the Department of Home Affairs also expanded the powers of home affairs minister Peter Dutton, who was the immigration minister.
Human rights and judicial watchdogs have said his powers were already far too broad and included the ability to over-rule the courts when judges overturn a visa cancellation.