A Minnesota police officer who fatally shot a black motorist seconds after the man informed him he was carrying a gun “did what he had to do” in a thoroughly justified use of force, a defense attorney argued Monday.

Hours earlier, prosecutors said the officer, Jeronimo Yanez, had never seen the gun and had plenty of options short of shooting Philando Castile, a 32-year-old school cafeteria worker they say was never a threat.

Yanez’s manslaughter trial went to a jury after both sides gave closing arguments in which they recapped their versions of a shooting that drew extra attention because Castile’s girlfriend livestreamed the gruesome aftermath on Facebook.

Yanez’s attorney, Earl Gray, reminded the jury of the officer’s testimony that Castile looked like a man who had robbed a convenience store four days earlier. He said Castile had disregarded the officer’s orders and reached for his gun because he was stoned on marijuana. And he said Yanez had been afraid for his life.

“He pulled out his gun, and he did what he had to do,” Gray said.

The prosecutor Jeff Paulsen highlighted autopsy evidence in his closing argument, reminding the jury of a bullet wound to what would have been Castile’s trigger finger – and noted that there was no corresponding bullet damage nor wounds in the area of Castile’s right shorts pocket, where he carried his gun. He also cited testimony from first responders of Castile’s gun falling out of his pocket as he was loaded onto a backboard.

He asked the jury to consider what might have happened if Yanez, when told of the gun, had simply stepped back a few feet to better assess the situation. The officer might have heard Castile say he was just trying to get his wallet, Paulsen said.

“If he had done that, everybody would have gone home safely that night,” the prosecutor said. He also alluded to testimony from defense witnesses who portrayed Yanez as a good and honest man.

“The victim in this case was a good man, too,” Paulsen said, and referred to Castile’s job at an elementary school. “The kids loved him, and he was a role model to them. And now they’ve been deprived of that role model.”

Castile had THC, the high-giving component of marijuana, in his blood when he died. The two sides called competing experts earlier who disagreed over whether Castile was incapacitated. Gray hit the issue again in his closing.

“Guns and drugs don’t mix. This is a classic example of why, if you are a user of drugs, even marijuana, you’re not allowed to have a gun,” Gray said.

Yanez, who is Latino, is charged with second-degree manslaughter, punishable by up to 10 years in prison, and with two lesser counts of endangering the safety of Castile’s girlfriend, Diamond Reynolds, and her daughter for firing his gun into the car near them.

Conviction on the manslaughter charge requires the jury to find Yanez guilty of “culpable negligence”, which the judge described in jury instructions as gross negligence with an element of recklessness.

After three white alternates were dismissed following closing arguments, the 12-member jury includes two black people. The rest are white. None are Latino.

Yanez testified Friday that he stopped Castile in the St Paul suburb of Falcon Heights because he thought Castile looked like one of two men who had robbed a nearby convenience store a few days earlier. A faulty brake light gave the officer sufficient reason to pull him over, several experts testified.

Squad-car video played repeatedly for the jury last week shows that the situation escalated quickly, with Yanez shooting Castile just seconds after the driver volunteered, “Sir, I have to tell you, I do have a firearm on me.” Five of the officer’s seven shots struck Castile.

After he shot Castile, Yanez is heard on the squad car video telling a supervisor variously that he didn’t know where Castile’s gun was, then that he told Castile to get his hand off it. Yanez testified Friday that he meant that he didn’t know where the gun was “up until I saw it in his right thigh area”.

Paulsen reminded the jury of the recorded statements on Monday, saying they should consider them accurate. Gray said prosecutors were taking the statements out of context.