As Kerikeri solo dad Neil Arthur Phillips entered the dock for sentencing on dope dealing charges, his two teenage sons rushed over from the public gallery to give him a hug.
Such contact between prisoners in the dock and those in the public gallery is usually frowned upon by the judiciary, but this spontaneous show of love helped save Phillips from going to jail by the "narrowest of margins".
Phillips, 49, appeared for sentencing in the High Court at Whangarei before Justice Paul Heath after earlier pleading guilty to six charges of selling cannabis and six of possessing cannabis for supply.
He was caught in Operation Dan, an undercover police sting targeting drug dealers from November 2011 to June this year.
Justice Heath said Phillips was an enigma who had two sides to his character. One was a loving father who had done a great job of bringing his two teenage boys up by himself - the other was a man who had alcohol and drug issues and took part in illegal activities.
An undercover officer visited Phillips' Kerikeri home six times over two months, buying $50 bags of cannabis, but Phillips also said he could supply 28-gram bags.
Crown prosecutor Catherine Anderson asked for a starting point of three years' jail with six months added for Phillips' previous drug convictions, which went back over 20 years.
Defence lawyer Doug Blaikie sought a starting point of two-and-a-half years' jail, with reductions for his guilty plea and mitigating circumstances taking it down to two years, which would open the door for home detention.
Mr Blaikie said Phillips sold cannabis to help bring up his children and the undercover officer put huge pressure on him to sell him the drug.
Phillips had also been in custody for several months and the cannabis sold was worth only about $1630, Mr Blaikie said.
Justice Heath said when he came to court he was looking at sending Phillips to jail.
However, he had decided to give him one last chance with 12 months' home detention.
"When you came into court your two boys went over spontaneously to greet you. It was very clear to me the nature of your relationship with them," Justice Heath said.
"It's clear you did a very good job raising your children. But on the other hand you behave like this, in a manner that shows you lack control of yourself."
He said the reaction of Phillips' sons and Mr Blaikie's submissions had persuaded him by the narrowest of margins to give Phillips another opportunity to turn his life around.
"... And to repay your children for the time you have spent away from them through your own stupidity of being involved in actions of this type," Justice Heath said.
"I still have some misgivings about whether I'm doing the right thing today. I hope you prove in the fullness of time that I've made the right decision."
Phillips' sons thanked the judge for his leniency from the public gallery after the sentence was delivered.
For more articles from this region, go to NORTHERN ADVOCATE