FILE - This Jan. 8, 2013, file photo provided by Christian Dobratz shows St. Anthony police officer Jeronimo Yanez outside the city council chambers in St. Anthony, Minn. Prosecutors announced Wednesday, Nov. 16, 2016, that Yanez, the officer who fatally shot Philando Castile during a traffic stop on July 6, 2016, in Falcon Heights, Minn., has been charged with second-degree manslaughter in the killing. (Christian Dobratz via AP, File)
FILE - This Jan. 8, 2013, file photo provided by Christian Dobratz shows St. Anthony police officer Jeronimo Yanez outside the city council chambers in St. Anthony, Minn. Prosecutors announced Wednesday, Nov. 16, 2016, that Yanez, the officer who fatally shot Philando Castile during a traffic stop on July 6, 2016, in Falcon Heights, Minn., has been charged with second-degree manslaughter in the killing. (Christian Dobratz via AP, File)

When Philando Castile was pulled over in July, he calmly told the officer he had a gun and was licensed to carry it, according to prosecutors. Moments later, the officer fired on the motorist, and a bleeding Castile uttered his last words: “I wasn’t reaching for it.”

On Wednesday, that officer was charged with second-degree manslaughter following an investigation by prosecutors, who concluded that Jeronimo Yanez was wrong to use his weapon in the traffic stop, which was seen by millions after Castile’s girlfriend streamed his final gruesome moments live on Facebook.

“No reasonable officer, knowing, seeing and hearing what Officer Yanez did at the time, would’ve used deadly force under these circumstances,” Ramsey County Attorney John Choi said.

Prosecutors believe Castile never tried to pull his handgun from his pocket, and Yanez’s unreasonable fear did not justify the shooting, Choi said.

If convicted, the officer could face up to 10 years in prison.

Diamond Reynolds was sitting next to her boyfriend in the car. She said he was shot repeatedly as he reached for his ID after telling Yanez about the weapon and the gun permit.

The fatal shootings of black men and boys by police officers have come under heightened scrutiny since the 2014 death of Michael Brown in Ferguson, Mo. No charges were filed against the officer in that case, but Brown’s death led to calls nationwide for officers to be held criminally responsible.

Yanez, who worked in the Minneapolis suburb of St. Anthony, was scheduled to make his first court appearance Friday.

His attorney, Tom Kelly, has said Yanez, who is Latino, was reacting to the presence of a gun. Kelly has also said that one reason Yanez made the stop was because he thought Castile looked like a possible match for an armed robbery suspect.

Choi said Wednesday that Castile was not a suspect in that robbery. Castile’s mother, Valerie Castile, said her family was pleased with the charge.

“It is necessary for everyone to understand that we want peace,” she said. “We don’t want any protests to get outrageous.”

Castile’s shooting prompted numerous protests, including a demonstration outside the governor’s mansion that went on for weeks and one protest that shut down Interstate 94 in St. Paul, Mo., for hours. The interstate protest resulted in about 50 arrests and injuries to more than 20 officers who were hit with cement chunks, bottles, rocks and other objects.

Choi resisted pressure to turn the case over to a special prosecutor, but he added one to his team to get an outside perspective. He said Wednesday that he reviewed the case himself instead of sending it to a grand jury in the interest of transparency.

He gave a detailed account of the shooting, describing a routine traffic stop that turned frantic after Castile told the officer he was carrying a gun. He was not required to do so by law.

Yanez had his hand on his holster before Castile could finish his sentence and repeatedly shouted “Don’t pull it out” as Castile insisted he wasn’t, Choi said.

Within a minute of the initial stop, Yanez unholstered his gun and fired seven shots at Castile.