MINNEAPOLIS -- The final moments before Philando Castile was killed by a police officer during a traffic stop in suburban St. Paul revolved around a gun he was licensed to carry, trained to use safely and instructed to tell authorities about when stopped.
Philando Castile's girlfriend seeking justice
Minnesota Governor: Philando Castile would be alive if he were white
But just how he informed the officer - and whether the officer followed his own training - gets to the heart of the investigation into Castile's death last week.
Castile, who was black, was fatally shot July 6 after he was pulled over by St. Anthony police officer Jeronimo Yanez, who is Latino. Castile's girlfriend streamed the aftermath live on Facebook and said Castile was shot while reaching for his ID after telling the officer he had a gun permit and was armed.
Woman who live streamed boyfriend's shooting speaks out
Yanez's attorney has said the officer reacted after seeing a gun, and that one of the reasons he pulled Castile over was because he thought he looked like a "possible match" for an armed robbery suspect. Castile's family says he was profiled because of his race.
A letter from the Hennepin County Sheriff's Office confirms Castile, 32, got his permit last year. The letter, dated June 4, 2015, says Castile's permit is enclosed. It also says that he must have his permit card and photo identification when carrying a pistol, and must display those items "upon lawful demand by a peace officer."
Allysza Castile said she and her brother took a required gun safety class together last year.
Dan Wellman, owner of Total Defense in Ramsey, confirmed the Castiles came to class in May 2015. Wellman doesn't remember the pair. He said he wasn't teaching the class that day.
But each class is told repeatedly how to handle a traffic stop or any encounter with law enforcement, he said. Students are taught to comply with every demand, hand over their permits to carry with their driver's licenses and calmly answer follow-up questions about licensed firearms, including where they are.
"We make several jokes about it during class: 'I have a gun' is not the way to say you have a gun on you," Wellman said.
Race never comes up as course participants are told how to handle traffic stops, Wellman said.
Castile's girlfriend, Diamond Reynolds, who was a passenger in the car along with her 4-year-old daughter, stressed in her video that Castile complied with Yanez's requests before the encounter turned fatal. But when talking to reporters the day after his death, she shed light on possible confusion stemming from Castile's final words to the officer.
"As he's reaching for his back pocket wallet, he lets the officer know: 'Officer, I have a firearm on me," she said. "I begin to yell, 'But he's licensed to carry.' After that, (the officer) began to take off shots."
St. Anthony police training documents outline how an officer should respond to traffic stops. According to the documents, if an officer believes it's a high-risk stop - as one involving an armed robbery suspect would likely be - he should have the driver and others exit the car before approaching the vehicle, while officers take cover and draw their weapons.
Albert Goins, an attorney who assisted the Castile family after the shooting but is not representing anyone in the case, has said if Yanez and the other officer involved, Joseph Kauser, believed they could be stopping the robbery suspect, they should have done a "felony stop." He described a procedure similar to what is outlined in the police training documents.
Yanez's attorney and the St. Anthony police chief did not return messages for comment Wednesday.
Court and driver records show Castile was pulled over or ticketed at least 52 times in Minnesota since 2002, with 86 total misdemeanor or petty misdemeanor counts. More than half of the 86 violations were dismissed, court records show. He had no serious criminal record.
He was stopped at least two times since he received his permit to carry. Records do not indicate whether he had his gun with him on those stops.
Allysza Castile said she usually leaves her gun at home. But if she does have it with her while driving, she said she puts it in her glove compartment in a holster with the safety on.
"Most of the time, he did the same," the 23-year-old woman said of her brother. "There's never a time I saw him driving in the car with his weapon on his person."
She said when she is pulled over and has her gun, she tells officers she has a firearm and gun permit, which is a wallet-size card that she shows with her license and registration.
"That's usually how it's supposed to go, but they didn't give him a chance," she said of the fatal stop.
Valerie Castile stressed that her son got his permit because he had a right to carry a weapon - not because he felt his life was in danger.
"My son was profiled and he was executed. There's just no two ways around that," she said.