A Minnesota police officer has been charged with second-degree manslaughter in the July shooting of Philando Castile, a black man whose death was streamed live on Facebook, prosecutors announced Wednesday.

Officer Jeronimo Yanez, 28, shot Castile, 32, during a July 6 traffic stop in Falcon Heights. Castile's girlfriend, Diamond Reynolds, who was with him in the car, streamed the shooting's gruesome aftermath on Facebook Live. She said Castile had been reaching for his ID after telling Yanez he had a gun permit and was armed.

IOWA WOMAN DRAWS BACKLASH AFTER TAUNTING POLICE OFFICERS WEARING BLACK BANDS

Ramsey County Attorney John Choi said the officer was not justified in believing deadly force was necessary. "I cannot allow the death of a motorist lawfully carring a firearm under these facts and circumstances to go unaccounted for."

Yanez's attorney said the officer made the stop because Castile looked like a possible match for an armed robbery suspect, and Yanez reacted to the presence of a gun. Family members claim Castile, an elementary school cafeteria worker, was racially profiled. Yanez is Latino. Castile was black.

Choi said Castile's last words were "I wasn't reaching for [the gun]."

GUN USED TO SHOOT ALASKA POLICE OFFICER TIED TO FIVE MURDERS

There was no immediate response from Yanez. In Minnesota, second-degree manslaughter, or involuntary manslaughter, carries a maximum prison sentence of 10 years. The officer was set to make his first court appearance Friday morning, Fox 9 reported.

The attorney got the case in late September and began reviewing the evidence for possible charges. Choi resisted pressure immediately after the shooting to turn the case over to a special prosecutor, but added one to his team to get an outside perspective. He also enlisted the help of national use-of-force consultants.

Castile's shooting prompted numerous protests, including a weekslong demonstration outside the governor's mansion and one rally that shut down Interstate 94 in St. Paul for hours. The interstate protest resulted in about 50 arrests and injuries to more than 20 officers, after police said they were hit with cement chunks, bottles, rocks and other objects.

Deadly shootings at the hands of police officers have come under heightened scrutiny since the 2014 death of Michael Brown in Ferguson, Missouri, and led to calls nationwide for officers to be held criminally responsible. No charges were filed in that case.

Police have faced charged in other cases, though. Michael Slager, a white officer in North Charleston, South Carolina, who has since been fired, is currently on trial for murder in the 2015 death of 50-year-old Walter Scott, an unarmed black man who was shot while running from a traffic stop. More recently, Betty Jo Shelby, a white Tulsa, Oklahoma, police officer was charged with first-degree manslaughter in the Sept. 16 shooting of Terence Crutcher, a 40-year-old unarmed black man whose car was stopped in the middle of the road.

When looking at whether to file charges, authorities must determine if the officer believed he or she, or fellow officers, were in danger in the moment the decision is made to shoot. If the fear of danger is deemed reasonable, charges are typically not filed. To prove a serious charge such as murder, prosecutors must also show that the officer was not just reckless, but had ill intentions.

Click for more from Fox 9.

The Associated Press contributed to this report.