The Court of Appeal has been told that the Director-General of Health did not have the power to put the country into Covid-19 alert levels 4 and 3.
Former law drafter Andrew Borrowdale won part of his judicial review in the High Court in Wellington in July last year.
The High Court ruled the first nine days of the level 4 lockdown requiring people to stay home were justified but unlawful.
But Dr Borrowdale is appealing parts of the decision that did not go his way.
In the Court of Appeal today his lawyer Jim Farmer QC said the law did not allow Ashley Bloomfield - who passed a series of orders under the Health Act - to make people stay home in their bubbles.
He told the court that even in exceptional circumstances - which the pandemic clearly was - it was important the rule of law be followed.
"There is that proviso ... that policy .... must be implemented by law, that Dr Borrowdale says was not observed when the lockdown was effected by orders made by the Director-General of Health under Section 70 of the Health Act 1956.
"That was an error."
Jim Farmer said the government needed to change the law if it wanted to put the whole country into lockdown - something it could have pushed through Parliament in a day if necessary.
He said it did this on a different matter at about the same time - passing legislation forcing schools to close.
"Instead of doing something similar on a broader scale, the director-general issued orders under the Health Act.
"And we say that those orders were not, in fact, adequate or fit for purpose to deal with a national lockdown.
"And so we say that in fact the Director-General when he made those orders he acted 'ultra vires' ... he simply did not have the power to make orders of that breadth and scope."
Jim Farmer said Dr Borrowdale was not disputing that action was needed to tackle Covid-19, but that it needed to be done lawfully.
He said the error was not corrected until months later when the Covid-19 Public Health Response Act was passed.
Cabinet knew in March special powers needed - lawyer
Jim Farmer QC said Cabinet recognised prior to lockdown on 25 March that it may need special new powers - in other words, legislative powers that did not exist at that time.
"But that was not acted upon … instead they left it to the Director-General to exercise what we say are much more limited powers, and not appropriate powers under section 70 of the Health Act."
He said the principle of legality held - that Parliament must squarely confront what it was doing and accept the political cost.
Law specified rather than universal
Jim Farmer's son Leo Farmer is also appearing for Dr Borrowdale.
He said the legislation being used - the Health Act of 1956 - was derived from earlier legislation that only allowed for people to be made to quarantine on a case-by-case basis.
"The District Health Officer, as they were known then, may require persons, places, buildings, ships, animals and things, to be isolated, quarantined or disinfected as he thinks fit."
Leo Farmer said as the law developed it kept this constrained character, pertaining to specific places, regions, or groups of people rather than being applied to the whole country in a blanket way.
And he said Dr Bloomfield did not have the legal basis to delegate to officials the power to decide which business were "essential" - described as providing or supporting those that provide the "necessities of life" - and could therefore stay open.
He says this went beyond the officials' remit.
The comma problem - Law Society
Tim Stephens from the Law Society - which is a neutral party to proceedings - said it was reasonable for the Director-General to set some rules and take advice from officials, but he could not delegate to them.
He said the problem hinged on the way the order was written - it referred to a list of businesses considered essential on the Covid-19 website.
"The words after the comma arguably suggests that it was left to others to determine the parameters of the definition.
"So it's the words that start 'as described on the Covid-19 website' that's the problem.
"That there is a reference off to the Covid-19 website for whether businesses are in or out of the definition."
He said it would have been fine if the clause stopped at the comma.
Stephens said what was considered an essential business was also updated on the Covid-19 website, and there is no evidence that Dr Bloomfield was making decisions about those updates or engaging with the content of the list.
The Crown will present its case on the final day of the hearing tomorrow.