A Melbourne man shot a friend twice during an argument before assaulting a policeman, who found him asleep at the wheel of a stolen car.
Bassim Al Hamzah, 26, has pleaded guilty to multiple charges, including intentionally causing serious injury, assaulting a police officer and reckless conduct endangering life, over the 2017 crime spree.
Victorian County Court judge Liz Gaynor described the shooting as a "nasty incident" linked to Al Hamzah's drug habit.
"Once you start using, you start spiralling," she said on Wednesday.
Al Hamzah had asked the friend's partner if he could park a stolen car at the couple's home in Reservoir on Boxing Day in 2016.
He returned to their home almost two weeks later, but had trouble starting the car.
Al Hamzah then asked if he could use his friend's vehicle but he declined.
"The offender got angry and left," prosecutor Kevin Doyle said.
Al Hamzah returned to the Reservoir home that night and got into an argument with his friend.
"The offender produced a small black gun," Mr Doyle said.
"He told the victim he was going to shoot him, and fired a single shot into his leg."
Incensed, the friend called Al Hamzah a "motherf***er and a dog" and threw a broom at the then 25-year-old.
Al Hamzah then shot the man a second time in the same leg, prompting the man to run inside the house.
He continued to fire multiple bullets through the house as the man tried to run for cover.
Two days after the shooting, police spotted Al Hamzah driving a vehicle with stolen registration plates and gave chase, but he managed to lose them.
He was later found slumped over the car's console, with the engine still running.
As police smashed open the window to arrest Al Hamzah, he woke up and started to punch and claw at two police officers.
He continued to resist arrest even after they wrestled him onto nearby grass, Mr Doyle said.
Al Hamzah, who has been in custody since his arrest, returns to court in June for a further plea hearing.