The case against a St. Anthony police officer who fatally shot Philando Castile during a traffic stop this past summer is heading to trial.

In an order issued Wednesday afternoon, Ramsey County District Judge William Leary denied a defense motion to have the charges against Jeromino Yanez dismissed on the grounds they lacked probable cause.

Defense attorneys also argued that Castile was high on marijuana when Yanez shot him, making the 32-year-old black man culpable in his own death.

Leary found that prosecutors had met the legal threshold necessary to move forward.

“This court concludes that the evidence, as interpreted by the state, is substantial enough to create a likelihood that, if the state’s interpretation is accepted by a jury, the state could prevail,” the order reads. “Consequently… it is fair and reasonable to allow this matter to proceed to trial.”

Leary went on to write that the defense’s argument that Castile was somehow to blame for his death because he was high had “failed.”

“A victim’s unreasonable conduct is never an absolute defense to a criminal charge,” the order said.

The judge issued his decision hours after a Wednesday morning hearing on the motion drew supporters for both Castile and Yanez to the Ramsey County Courthouse.

Leary gave defense attorney Paul Engh the first opportunity to present reasons for asking for the dismissal during the proceeding. Assistant U.S. Attorney Jeffrey Paulsen countered with arguments on why the case should go to trial.

Chief among the defense’s position, Engh argued, was that the charges lacked probable cause because Yanez had acted within the rights afforded him as a police officer when he made the decision to fire at Castile July 6.

As a police officer, Engh said Yanez had the right to be carrying a gun that night, the right to stop Castile for his vehicle’s broken tail light, the right to have his orders obeyed, and the right to shoot when he felt his life was in danger.

The defense further argued that Castile was high at the time and therefore had no right to be driving a vehicle or carrying a gun. His impairment made him culpable in his death, Engh argued.

Prosecutors maintained that there are numerous “facts in dispute” in the case that should be left for a jury to decide.

Among them, Paulsen said prosecutors disagree with the defense statement that Castile was reaching for his gun when Yanez shot him seven times. Instead he was reaching for his wallet to comply with Yanez’s request to see his driver’s license, he argued.

Further, he disputed the claim that Yanez actually saw Castile’s gun, pointing out that when first interviewed after the shooting, Yanez reportedly said, “I don’t know where the gun was.”

He also said that, while Castile was found to have had THC — an active ingredient in marijuana — in his system at the time of his death, Castile was not “impaired” at the time of the traffic stop. He added that video captured of the incident backs that up.

He also argued against the defense’s claim that Castile’s use of marijuana could somehow negate his right not to be recklessly shot by a police officer.

“The central question in this case… is not whether (Castile) had a right to carry a gun … it was his right not to be killed for no good reason,” Paulsen said.

He added that Yanez’s subjective opinion that he faced a threat to his life was not an adequate defense. Instead, he said the legal standard is based on the “objective” assessment of what a “reasonable officer” would do under the same circumstances.

“If all (a police officer) had to do is say, ‘I felt threatened and you have to believe me, Judge,’ there would never be a prosecution (in these cases.) … That’s what a trial is for,” Paulsen said.

The St. Anthony police officer was charged in November with one count of second-degree manslaughter and two felony counts of dangerous discharge of a firearm for fatally shooting Castile during a July 6, 2016, traffic stop in Falcon Heights. Castile was in the car at the time with his girlfriend and her young child.

Yanez wore a beige suit at the hearing. Sitting next to his team of attorneys, he said nothing during the roughly 40-minute proceeding.

Earl Gray, another of Yanez’s defense attorneys, said that while the defense had hoped to win its motion Wednesday, he was still confident Yanez would prevail at trial.

“Before you can be convicted, a jury has to find unanimously that your client is guilty beyond a reasonable doubt,” Gray said. “Well, I believe that when we present the (findings) about Castile’s conduct that night compared with our client’s, I don’t think it will take a jury long to find that the state has failed miserably to prove their case beyond a reasonable doubt.”

Some of Yanez’s fellow officers, including the St. Anthony police chief, attended the Wednesday hearing.

Castile’s family and friends took up two rows inside the courtroom.

His mother, Valerie Castile, said afterword that the future of the case is “in God’s hands,” and reiterated the integrity of her son and the depth of loss she and her loved ones have had to carry since his death.

“He was an amazing human being,” she said.

Castile graduated from Central High School in 2001. He was a longtime employee for the St. Paul school district, where he worked in an elementary school as a kitchen supervisor. He had never been convicted of a felony in Minnesota.

Yanez, who is Latino, is married with one child. The 28-year-old became a licensed police officer in 2011 and joined the St. Anthony Police Department about four years ago.

He has no record of complaints against him in his personnel file.

The next hearing in the case is scheduled for Feb. 27. Yanez is expected to enter a plea during the proceeding.