This was the first time we've heard from Yanez, since he was charged with manslaughter in the 32-year-old's death last July.
"I was scared to death," he said on the stand. "I thought I was going to die. My family popped into my head. My wife. My baby girl."
Yanez's voice broke several times as he recounted the series of events on that fateful day -- a day he said he felt he had no other choice than to fire his weapon during that traffic stop.
"I was forced to engage Mr. Castile," he said. "I did not want to shoot Mr. Castile. Those were not my intentions."
Yanez told the jury the reasons why he stopped Castile on that July 6 night -- that his description fit that of a robbery suspect, an incident he responded to on July 2. Four days later, during roll call, Yanez said he and his fellow officers were reminded again to be on the lookout for possible suspects in that case, as none had been found.
He said as Castile drove by his squad car, he locked eyes with him and remembered him having a "deer in the headlights" look.
Castile was roughly the same age, same race and had similar dreadlocks to the robbery suspect, Yanez testified.
So he stopped the vehicle. He said when he approached Castile's car, he "was hit with the odor of burnt marijuana from within the vehicle."
He said Castile's left hand was on the steering wheel and his right hand was below it.
When he told Castile not to reach for his weapon, Yanez said, "I was able to see his right hand, it was in a C-shape. And he continued to pull out the firearm."
"He had total disregard for my commands," Yanez said.
During the cross examination, Yanez was questioned why he didn't tell the BCA investigators a description of Castile's gun but instead, told an officer who drove him home afterwards.
Yanez said he had nothing to hide during his interview with the BCA.
He said he reached into the car to try and stop Castile but felt the use of force was necessary, reasonable but ultimately tragic.
KARE 11's Lou Raguse said during Yanez's testimony, Castile's family looked on, completely composed. The jury listened to Yanez's testimony intently, not showing emotion.
Later Friday, the defense rested its case. Closing arguments are set for Monday. The 15-member jury could begin deliberations as early as Monday. The jury includes three alternates, but it's not clear who the alternates are. Two of the 15 are black.