The police officer who fatally shot Philando Castile recounted his story publicly for the first time Friday, 11 months after a viral Facebook Live video of the aftermath brought the world an extraordinarily intimate look at police shootings.

Officer Jeronimo Yanez pulled off his glasses and wiped his eyes on the last day of testimony in his manslaughter trial, recounting how a traffic stop turned deadly in about a minute.

“I thought I was going to die,” Yanez testified, with a packed courtroom hanging on his every word. “I had no other choice. I was forced to engage Mr. Castile. He was not complying with my directions.”

Jurors heard testimony from several witnesses this week and are expected to begin deliberations Monday after final arguments.

“I thought it went splendid,” one of Yanez’s attorneys, Earl Gray, said of the defense’s two-day case.

Yanez, 29, is charged in Ramsey County with second-degree manslaughter and two counts of reckless discharge of a firearm in the July 6 shooting of Castile, 32, in Falcon Heights. Castile’s girlfriend, Diamond Reynolds, and her daughter, then 4, were also in the car. Reynolds live-streamed the aftermath.

Yanez testified that he felt his life was in danger when he saw Castile grab a gun near his right thigh after he had been ordered not to reach for it. Yanez told the court that visions of his wife and “baby girl” flashed through his mind.

Did you want to shoot Mr. Castile? asked Yanez’s attorney, Thomas Kelly.

The St. Anthony police officer began to cry. “I did not want to shoot Mr. Castile at all,” he replied. “Those were not my intentions.”

Yanez testified that four days earlier, he responded to an armed robbery of a nearby Super USA convenience store and watched video of two black men pointing guns at a clerk. Officers were instructed to look out for the suspects.

Yanez was parked in his squad car when he saw Castile drive by on July 6. They made eye contact.

“He gave me a deer-in-the-headlights look,” Yanez said. “It’s a trigger.”

Yanez said that gave him “strong suspicions” about Castile, whom he believed could be one of the robbery suspects. Yanez said Castile had a nonworking brake light, which gave him legal grounds to conduct a “pretext” traffic stop that’s then used to investigate other crimes.

He said he smelled marijuana as he walked up to Castile’s Oldsmobile. He informed Castile about the brake light issue, then asked for Castile’s license and proof of insurance.

Castile handed over the insurance information, which the officer tucked into his breast pocket.

“Sir, I have to tell you that I do have a firearm on me,” Castile volunteered, according to the criminal complaint filed against Yanez.

“I told him, ‘Don’t pull it out,’ ” Yanez testified in court.

Castile reached to his right and made a C-shape with his right hand, Yanez said, adding that he tried to distract Castile, but “he continued to pull his firearm out of his pocket.”

Kelly tried to head off the prosecution’s cross-examination by asking Yanez why he told his supervisor after the shooting that he “didn’t know where the gun was.”

“I was telling [my supervisor] I didn’t see the gun until I saw one,” Yanez answered. “I didn’t know where it was on Philando Castile’s person.”

Prosecutors have run with the theory that Yanez’s failure to use the word “gun” to alert responding officers at the scene and his language with investigators indicate that he never saw Castile’s gun, which was later recovered from his right front shorts pocket.

Yanez repeatedly used the word “it” and made statements such as, “And, he put his hand around something,” in the conversation with his supervisor and in an hourlong interview with investigators from the Minnesota Bureau of Criminal Apprehension (BCA) the next day.

“You didn’t say firearm,” Assistant Ramsey County Attorney Rick Dusterhoft said of Yanez’s BCA interview.

“Correct,” Yanez said.

“You didn’t say he grabbed a gun,” Dusterhoft said. “… You didn’t say ‘firearm.’ You said ‘object,’ correct?”

“Correct,” Yanez said. “… My mind was all over the place, because I was under a tremendous amount of stress. It was a firearm.”

Yanez was composed and spoke clearly under questioning from Kelly. But he grew mildly defiant when Dusterhoft grilled him for telling the BCA that he saw the barrel of Castile’s gun when he hadn’t.

Yanez asked to handle a replica of Castile’s gun. He stood up, faced jurors, grabbed the gun’s handle with one hand and pointed near his grip. “That’s what I saw,” he said.

“You said ‘barrel’ twice,” Dusterhoft said of the BCA interview.

“What I meant was the slide, the top part of the slide,” Yanez explained.

“You appear to be unsure of what you saw,” Dusterhoft said a few questions later. “No,” Yanez said, “I was sure.”

What did Yanez see?

In a dramatic courtroom demonstration earlier in the day, the defense’s use-of-force expert placed the replica of Castile’s handgun into the pocket of a pair of shorts identical to the ones Castile was wearing when he was shot.

The gun filled the pocket, its butt protruding visibly.

“That places the butt of the gun right here where the slash of the pocket is,” said defense expert Emanuel Kapelsohn. “I can just easily reach in with a couple of fingers and the gun is right there.”

Yanez would have “easily” seen the butt of the gun while standing outside Castile’s car, Kapelsohn testified.

Prosecutor Jeffrey Paulsen tried to knock the wind out of Kapelsohn’s display, calling it a “little demonstration.” The replica gun and shorts were previously introduced by prosecutors as evidence.

Kapelsohn said that it took him about one-third of a second to draw a replica gun from identical shorts. An officer typically takes longer — about half a second — to respond to a threat, he said.

Yanez had reason to shoot Castile because Castile failed to follow orders, Kapelsohn testified. “He’s justified in [using deadly force], and he’s trained to do so. He’d be remiss if he didn’t do so.”