Each moment of the July 6 exchange was captured on audio from Yanez's squad car and on video.
Now, Yanez, who worked for the St. Anthony, Minnesota, police department, faces trial on charges of second-degree manslaughter and two felony counts of dangerous discharge of a firearm. The trial opens this week with jury selection.
The aftermath of the shooting was streamed live on Facebook by Castile's fiancée, Diamond Reynolds, who was in the car with him, as was her 4-year-old daughter. She calmly explained what had taken place, saying they had been pulled over for a broken tail light.
The video quickly went viral, sparking protests nationwide and renewing criticism of the use of deadly force by police, especially against African-American men.
The incident was one of several similar shootings last summer: On July 5, Alton Sterling was shot and killed outside a convenience store in Baton Rouge by police responding to a report of a man with a gun. A bystander filmed that deadly encounter as well.
In Minnesota, Ramsey County Attorney John Choi announced the charges against Yanez in November, saying that "No reasonable officer knowing, seeing and hearing what Officer Yanez did at the time would have used deadly force under these circumstances."
But prosecutors have not had much success convicting police officers in high-profile cases, even when the shooting is caught on video.
Yanez's attorney told CNN previously that the shooting had nothing to do with race and everything to do with a gun being present at the scene.
Timeline of the encounter
The critical minute -- from the time Yanez pulled over Castile in Falcon Heights to when the St. Anthony police officer fired the seventh and last shot at the Montessori school cafeteria worker -- will be heavily scrutinized throughout the trial.
Here's the timeline of the incident based on audio and video recordings, as presented in the criminal complaint
9:05:00 p.m. -- Castile's vehicle came to a complete stop.
9:05:15 - 9:05:22 p.m. -- Yanez approached Castile's car on the driver's side.
9:05:22 - 9:05:38 p.m. -- Yanez exchanged greetings with Castile and told him of the brake light problem.
9:05:33 p.m. -- St. Anthony Police Officer Joseph Kauser, who had arrived as backup, approached Castile's car on the passenger's side.
9:05:38 p.m. -- Yanez asked for Castile's driver's license and proof of insurance.
9:05:48 p.m. -- Castile provided Yanez with his proof of insurance card.
9:05:49 - 9:05:52 p.m. -- Yanez looked at Castile's insurance information and then tucked the card in his pocket.
9:05:52 - 9:05:55 p.m. -- Castile told Yanez: "Sir, I have to tell you that I do have a firearm on me." Before Castile completed the sentence, Yanez interrupted and replied, "Okay" and placed his right hand on the holster of his gun.
9:05:55 - 9:06:02 p.m. -- Yanez said "Okay, don't reach for it, then." Castile responded: "I'm... I'm ... [inaudible] reaching...," before being again interrupted by Yanez, who said "Don't pull it out." Castile responded, "I'm not pulling it out," and Reynolds said, "He's not pulling it out."
Yanez screamed: "Don't pull it out," and pulled his gun with his right hand. Yanez fired seven shots in the direction of Castile in rapid succession. The seventh shot was fired at 9:06:02 p.m. Kauser did not touch or remove his gun.
9:06:03 - 9:06:04 p.m. -- Reynolds yelled, "You just killed my boyfriend!"
9:06:04 - 9:06:05 p.m. -- Castile moaned and said, "I wasn't reaching for it." These were his last words.
9:06:05 - 9:06:09 p.m. -- Reynolds said "He wasn't reaching for it." Before she completed her sentence, Yanez screamed "Don't pull it out!" Reynolds responded. "He wasn't." Yanez yelled, "Don't move! F***!"
Reynolds started live-streaming onto Facebook about 40 seconds after the last shot.
Reynolds: "Stay with me, we got pulled over for a busted tail light in the back. And the police just he's, he's, he's covered. He, they just killed my boyfriend.
Reynolds: "He's licensed. He's carried, he is licensed lo carry."
Yanez: "Ma'am, just keep your hands where they are."
Reynolds: "I will sir. No worries. I will."
Reynolds: "He just shot his arm off. We got pulled over..."
Reynolds: "...on Larpenteur."
Yanez: "I told him not to reach for it. I told him to get his hand off of it."
Reynolds: "He had, you told him to get his ID, sir, and his driver's license. Oh my God. Please don't tell me he's dead."
What the officer said
Yanez's side of the story was partly posted on the Ramsey County Attorney's website. The officer was interviewed July 7 by investigators.
Yanez said Castile told him he had a gun at the same time he reached down between his right leg and the center console of the vehicle, the complaint said.
"And he put his hand around something," Yanez was quoted as saying. He said Castile's hand took a C-shape, "like putting my hand up to the butt of the gun."
Yanez said he then lost view of Castile's hand.
"I know he had an object and it was dark," he said. "And he was pulling it out with his right hand. And as he was pulling it out, a million things started going through my head. And I thought I was gonna die."
Yanez said he thought Castile had the gun in his right hand and he had "no option" but to shoot, the complaint said.