ST. PAUL, Minn. (Reuters) - The Minnesota policeman who shot and killed a black motorist last year feared for his life and was simply trying to protect himself, his lawyer said on Monday at the start of the officer’s trial on second-degree manslaughter charges.

FILE PHOTO: Minnesota police officer Jeronimo Yanez, charged in connection with the shooting death of a black motorist Philando Castile last July, is shown in this booking photo taken November 18, 2016 in St. Paul, Minnesota, U.S. Courtesy of Ramsey County Sheriff's Office/Handout via REUTERS

The killing, filmed in part by the victim’s girlfriend as he sat bleeding beside her in his car, sparked national outrage and triggered weeks of protests in St. Paul and Minneapolis.

St. Anthony Police Department officer Jeronimo Yanez, charged with killing Philando Castile, 32, fired his gun because Castile was reaching for a weapon he said he had, Yanez’s attorney, Paul Engh, said during opening arguments at the Ramsey County District Court in St. Paul, Minnesota.

“He reached for it,” Engh said of Castile, adding that Castile ignored two commands about not reaching for or pulling out his gun.

Engh said Yanez, who he described as “an exceptional human being” and son of a Mexican immigrant, will testify during the trial that Castile reached for his gun. Yanez pleaded not guilty to the charges in February.

The July 2016 shooting in the St. Paul suburb of Falcon Heights during a traffic stop, like other similar incidents across the United States, added to public debate about law enforcement and what many Americans perceive as the use of excessive force against minorities.

Richard Dusterhoft, assistant Ramsey County attorney, in brief opening remarks, played the police dashboard video of the traffic stop, during which Castile told Yanez he had a gun and, in response to a warning, said that he was not pulling it out.

Yanez fired seven shots and hit Castile five times, including twice in the heart, Dusterhoft said.

“He didn’t tell him to freeze,” Dusterhoft said of Yanez. “Officer Yanez’s actions led to Philando Castile’s death.”

Starting about 40 seconds after the shooting, Castile’s girlfriend, Diamond Reynolds, streamed images of a bloody Castile on Facebook Live from the vehicle’s passenger seat as her 4-year-old daughter watched from the back seat. The images quickly went viral on social media.

Yanez has said he was justified in stopping Castile’s car because he resembled a suspect in a convenience store robbery, according to court documents. Castile’s vehicle also had a broken brake light.

After Castile was stopped, Yanez asked him to present his driver’s license and insurance permit. Castile provided Yanez with his proof of insurance and disclosed he was carrying a licensed handgun.

The exchange took just over a minute and Castile’s permit to carry a gun was later found in his wallet.