They encountered Williams in the hallway who was up administering asthma medication to his 6-year-old son.
Williams grabbed an ornamental taiaha to fend off the balaclava-clad men as his wife Taryn Williams, woken by the confrontation, had the butt of a rifle smashed into her back. She was being stood over with a machete.
A fight ensued in the lounge before Williams, 38, ran to the laundry and broke into his gun cabinet, retrieving a rifle with inaccurate sights and loading it.
The Crown said the four men were retreating when Williams spied them out a window but Morgan said from his client's perspective the intruders were still outside and he believed they were coming back to get him.
"The car left but unfortunately it stopped and these men are out of it. So he leaves his place of refuge, goes across the courtyard of his home terribly exposed because the outside light's on, gets to the bush on the corner trying to work out what's going on, pokes his head around the corner and of course all his nightmares come true.
"There's a man just there facing him on the other side of the cattle stop. He can only see a silhouette of him but he's got his arms extended because he's holding a gun, and 'I think: It's him or me'."
Morgan asked how it could be that the men were "fleeing, escaping or retreating" if they were still there.
Williams turned the gun toward the car and pulled the trigger.
Morgan asked the jury to consider the emotional state of the defendant, who had just been attacked in a "terribly traumatic incident" by "arrogant men" who burst into his home in the middle of the night.
Men who had hatched a plan to rob the house, met at 2am in the seaside village of Kawhia with masks, gloves, weapons and a car and had a diagram supplied by a girlfriend depicting the house and the goods they were after.
He said Williams in that split second considered himself in extreme peril, that he was committed to his actions, compromised and had been seen, and was acting in self-defence, firing not out of anger but out of fear.
The Crown's case that Williams shot in anger was speculation that the jury could not consider and it had not been proved beyond reasonable doubt, Morgan said.
"It's a naked old guess and my submission to you is a naked old guess has no right in a place like this."
Morgan picked apart the Crown case, saying blood at the laundry doorway from Williams' head wound did not prove Williams and his wife conversed there, planning Taryn's getaway out a bedroom window with the two children.
The inference was that Williams would know his family were safe as he shot into the darkness shortly after.
Morgan added that because there was not blood in other areas where Williams said he was on the night, it did not mean he wasn't there.
At one point, the car was turned around so that the headlights shone on Williams. He fired again.
Putting himself in Williams' position Morgan said: "The way it appeared to me is they were coming back to get me. It was him or me. I needed to drive them off. And he did so.
"And in so doing ... he was acting in the defence of himself and he was acting in the defence of his family.
"In all of this was the tragic loss of one man's life and the serious injury of the other three."
Justice Mary Peters will sum up on Monday after which the jury will retire to decide the verdict.
• Shaun Te Kanawa, Grayson Toilolo and Joe Tumaialu were all charged with aggravated burglary for their part in the incident. Te Kanawa and Tumaialu have been sentenced. Toilolo's case is still before the court. Emma Salvation, who hatched the burglary plan, was convicted of burglary and sentenced to 12 months' home detention.