Minnesota police officer Jeronimo Yanez has been acquitted of manslaughter in the shooting death of black motorist Philando Castile.

The jury has found Yanez not guilty on all counts. He was also cleared of two lesser charges of endangering Castile’s girlfriend, Diamond Reynolds, and her daughter for firing his gun into the car near them.

Yanez pulled over 32-year-old Castile for a broken taillight in July 2016. The officer shot Castile five times after Castile said he was carrying a gun.

The shooting drew widespread attention, mainly because Castile’s girlfriend livestreamed the aftermath on Facebook.

Yanez, who is Latino, “did what he had to do” when he shot Castile, a defense attorney argued during the trial. Yanez testified that he feared for his life after Castile refused to not pull out his gun, despite the officer’s commands.

PHILANDO CASTILE SHOOTING: MINNESOTA OFFICER ‘DID WHAT HE HAD TO DO,’ ATTORNEY SAYS

Prosecutors argued that Yanez never saw the gun, and that he overreacted to a non-threat.

The trial included squad-car video of the traffic stop between the two, but footage did not show what happened in Castile’s car, leaving it up to the jury to believe Yanez’s testimony.

After three white alternates were dismissed after closing arguments, the 12-member jury included two black and ten white people.

The Associated Press contributed to this report.