Warning: Graphic content

A Minnesota police officer was acquitted of manslaughter Friday in the fatal shooting of a black motorist who had informed the officer seconds earlier that he was carrying a gun.

Jeronimo Yanez was also cleared of two lesser charges in the July traffic stop in a St. Paul suburb. Yanez testified that Philando Castile was pulling his gun out of his pocket despite his commands not to do so. The defense also argued Castile was high on marijuana and said that affected his actions.

Castile had a permit for the weapon. Prosecutors questioned whether Yanez ever saw the gun. They argued that the officer overreacted and that Castile was not a threat.

The case garnered immediate attention because Castile’s girlfriend, Diamond Reynolds, streamed the aftermath live on Facebook.

Yanez, who is Latino, was charged with second-degree manslaughter, punishable by up to 10 years in prison, though sentencing guidelines suggest around four years is more likely. He also faced two lesser counts of endangering Reynolds and her daughter for firing his gun into the car near them.

The jury got the case Monday, after just five days of testimony, evidence and arguments. The 12-member jury included two blacks. The rest were white. None was Latino.

Castile’s shooting was among a string of killings of blacks by police around the U.S., and the livestreaming of its aftermath attracted even more attention. The public outcry included protests in Minnesota that shut down highways and surrounded the governor’s mansion.

Castile’s family claimed he was profiled because of his race, and the shooting renewed concerns about how police officers interact with minorities. Minnesota Democratic Gov. Mark Dayton also weighed in, saying he did not think the shooting would have happened if Castile had been white.

Yanez testified that he stopped Castile in the St. Paul suburb of Falcon Heights because he thought the 32-year-old elementary school cafeteria worker looked like one of two men who had robbed a nearby convenience store a few days earlier. Castile’s car had a faulty brake light, giving the 29-year-old officer a legally sufficient pretext for pulling him over, several experts testified.

Squad-car video played repeatedly for the jury shows a wide view of the traffic stop and the shooting, with the camera pointed toward Castile’s car. While it captures what was said between the two men and shows Yanez firing into the vehicle, it does not show what happened inside the car or what Yanez might have seen.

The video shows the situation escalated quickly, with Yanez shooting Castile just seconds after Castile volunteered, “Sir, I have to tell you, I do have a firearm on me.” Five of the officer’s seven shots struck Castile. Witnesses testified that the gun was in a pocket of Castile’s shorts when paramedics removed him from his vehicle.

Prosecutors called several witnesses to try to show that Yanez never saw the gun and acted recklessly and unreasonably. But defense attorneys called their own witnesses to back up Yanez’s claim that he saw Castile pulling the gun and that Yanez was right to shoot.

After shooting Castile, Yanez is heard on the squad-car video telling a supervisor variously that he didn’t know where Castile’s gun was, then that he told Castile to get his hand off it. Yanez testified, “What I meant by that was I didn’t know where the gun was up until I saw it in his right thigh area.”

He said he clearly saw a gun and that Castile ignored his commandscharged to stop pulling it out of his pocket. His voice choked with emotion as he talked of being “scared to death” and thinking of his wife and baby daughter in the split-second before he fired.

Prosecutors argued that Yanez could have taken lesser steps, such as asking to see Castile’s hands or asking where the gun was. After Castile told the officer he had the gun, Yanez told Castile, “OK, don’t reach for it then,” and, “Don’t pull it out.”

On the squad-car video, Castile can be heard saying, “I’m not pulling it out,” as Yanez opened fire. Prosecutors said Castile’s last words were, “I wasn’t reaching for it.”

Reynolds testified that she began recording the shooting’s aftermath because she feared for her life and wanted to make sure the truth was known. Defense attorneys pointed to inconsistencies in several of her statements.

Defense attorneys also argued that Castile was high on marijuana and said that affected his behavior. But a prosecution expert testified there’s no way to tell when Castile last smoked marijuana or whether he was high.