An "enraged" shooter discovered dead in a creek was targeting his estranged wife and family when he went on a shooting spree in a quiet suburban area.
The Victorian woman, 55, along with her children, 20 and 15, had been seeking temporary refuge as she planned to separate from her husband of 23 years, police said.
The trio were inside a home in Auburn, in western Sydney, when the man tried to get inside shortly before 10pm on Tuesday.
He fired a shot into the house but no one was injured and he fled before police arrived.
NSW Police Assistant Commissioner Brett McFadden said "the man became enraged" and smashed a window at the property before firing the shot.
"We're very thankful ... we don't have yet another domestic-violence-related homicide on our hands," he told reporters on Wednesday.
"A wealth of support for the family has been thrown around ... trying to understand the circumstances that led to this."
The woman's parents, both in their 70s, were also in the house.
A short time later, police were called to another Auburn street only a few kilometres away after a 55-year-old man was shot in the neck while sitting in his car.
Investigators believe the shooter in the earlier incident tried to steal the car before firing another bullet and hitting the occupant.
The driver's 15-year-old daughter had been sitting in the passenger seat beside him at the time, police said.
The 55-year-old was taken to hospital in a serious but stable condition.
During a search of the area, police found the body of the shooter in nearby Duck River, along with a gun.
He did not have a known licence for the firearm, a detail that would form part of the police investigation into the incident.
Detectives believe the man travelled to Sydney from Victoria about two-to-three weeks before the shooting spree took place on Tuesday night.
No substantial incidents involving the man had come to police attention there since the 1990s, Mr McFadden said.
He noted the family's history would not have put them on police radar, which highlighted the challenge for officers in preventing attacks on vulnerable people.
"This is the real challenge for domestic violence in NSW ... trying to ensure that we are doing everything humanly possible with the information that is available to us to keep our victims and communities safe," Mr McFadden said.
NSW detectives will work with Victoria police as detectives work to get a broader understanding of the man's history before the shootings.
Lifeline 13 11 14
beyondblue 1300 22 4636
1800 RESPECT (1800 737 732)