Police later found the man several miles away.
He said he had been angered by the persistent barking of the woman's dog and took the knife from his kitchen with the express purpose of killing the woman because of the dog.
But he told police he was sorry and he did not want her dead.
In the High Court at Dunedin yesterday, the man pleaded not guilty to a charge of attempted murder. He was formally declared to have been insane at the time of the incident.
Because of that verdict and the detrimental effects of identification to the man's likely recovery, Justice Christine French granted the application by counsel Helgi Henderson for final name suppression for the man.
Crown counsel Robin Bates did not oppose such an order and the judge said she was satisfied it was "one of those exceptional cases where suppression was justified".
She also agreed with Mr Bates that the victim's name should also be suppressed.
Two psychiatrists confirmed the man suffered from paranoid schizophrenia, manifested by auditory hallucinations and delusional beliefs, and was likely insane at the time he attacked the victim.
Prof Philip Brinded said name publication would no doubt add to the man's potential psychological distress about his actions.
The man had been unwell for some years but had been living a comparatively normal life with medical treatment until removal of his medication "rapidly caused his disintegration".
In his report to the court, Prof Brinded said, in his opinion, the man was aware of the nature and quality of his actions.
He knew he was attacking and stabbing the woman but his state was such that he was unable to think rationally or reasonably about his actions and their consequences.
He was "in such a disordered state of mind" he would have been incapable of knowing his actions were morally wrong.
Justice French described the psychiatric reports as "compelling" and said she was satisfied on the basis of the expert evidence the man was legally insane at the time and not guilty of attempted murder on account of his insanity.
It was apparent he already had auditory hallucinations when he arrived in New Zealand in the mid 1990s, the judge said.
But under appropriate medication, he had been able to work until three years ago when his conditions regressed and his anti-psychotic medication was gradually withdrawn.
Within three weeks of stopping his medication last year, the man's auditory hallucinations and delusional beliefs returned.
Justice French said Prof Brinded's clear view was the man should be detained as a special patient.
He recommended that course because of the serious nature of the attack, the man's long-standing schizophrenia, the speed of his deterioration, his lack of insight into his illness and his persistent psychotic symptoms.
Having considered all circumstances in what she said was "a very sad case", Justice French said she was satisfied the making of the order was necessary in the interests of the public and of the man himself.