Mohammad Eimal Zarshoy is on trial in the NSW Supreme Court accused of murdering 44-year-old Robert Atkinson at his home in Wentworthville in the evening of June 29, 2020.
In early June 2020, Mr Atkinson obtained a Six Corp model KS-30 self-loading rifle from a colleague he had known from working at business removal firm Allied Pickfords Australia.
Crown prosecutor Katharine Jeffreys said the Wentworthville man had been in contact via Telegram with Zarshoy, who used the alias Yeah Yeah, to organise the sale of the gun.
Mr Atkinson told his friend Justin Ryan he would sell the firearm for $13,000 to "Habibs", a generic term he used to refer to people from Lebanon or the Middle East.
Another friend warned him not to sell the rifle to anyone "dodgy", jurors heard.
Zarshoy is accused of arriving at the Wentworthville property on June 29 to pick up the gun and then shooting Mr Atkinson in the leg with at least an intention to cause serious injury.
On leaving the house, he allegedly discharged the firearm at Mr Ryan with an intention to cause grievous bodily harm.
Mr Ryan will give evidence of how he ran at Zarshoy in the front yard while armed with a knife, grabbing the barrel of the gun as it was pointed towards him before a shot was fired.
Wrestling over the knife, Zarshoy was allegedly injured after grabbing the blade with his left hand. Mr Ryan then fled back inside while Zarshoy proceeded to a waiting ute which drove away, the jury was told.
Zarshoy, who has pleaded not guilty to both charges, was arrested on July 6, 2020.
The rifle was recovered on July 16 in a television box at a real estate agent in Auburn after police attended the business because Volkan Kurt blockaded himself inside a storeroom.
Zarshoy's barrister Ronald Driels questioned the strength of the Crown case, including what actually happened inside the house during the gun sale.
"Mr Atkinson's selling it. He's got the bullets, he's got the cartridges, he's got the gun. Who loaded it? Well, his DNA was found on the fired cartridge, not Mr Zarshoy's," Mr Driels said.
The barrister also pointed out that one of Mr Atkinson's housemates, who did not leave their bedroom during the incident, only heard one gunshot, throwing doubt on Mr Ryan's claims that a second shot was fired at him outside.
The trial before Justice David Davies continues.