A Prince George’s County judge on Tuesday threw out a hate crime charge filed against a white man on trial in the fatal stabbing of a black man at a University of Maryland bus stop.

A first-degree murder charge remains against Sean Urbanski, 24, in a case that is expected to go to the jury after closing arguments Wednesday. He is accused of killing Richard Collins III in the early hours of May 20, 2017.

Circuit Court Judge Lawrence V. Hill Jr., in response to a defense request after prosecutors closed their case, ruled that prosecutors had not met their legal burden in showing that Urbanski was motivated by racial hatred when he stabbed Collins with a knife.

In dismissing the hate crime charge, Hill said the statute requires prosecutors to show that an act was committed solely because of the identity of the target — a standard not met.

His ruling — though barely audible — stunned the courtroom. As the judge’s decision sunk in, Collins’s parents left, looking distraught.

Collins’s killing in the days before graduation had come during a time of racial tension on college campuses in the United States, including U-Md.

The ruling came after the defense presented witnesses showing that Urbanski’s blood alcohol level was at least twice the legal limit for driving to support their argument that Urbanski did not act willfully. Prosecutors had earlier presented evidence of Urbanski’s interaction with racist content on his phone and on Facebook.

The defense does not contest that Urbanski killed Collins, who was a 23-year-old ROTC student visiting friends at the College Park campus. Collins had received his commission as a second lieutenant in the Army about a week earlier and was a few days from receiving his business degree from Bowie State University.

Urbanski, from Severna Park, Md., had dropped out of U-Md. and spent that night with former classmates preparing for graduation.

Two friends who were waiting with Collins for a ride share at a bus stop — Blake Bender and Amanda Lee — testified that they heard yelling from a wooded area nearby before Urbanski appeared.

“Step left, step left if you know what’s best for you,” Urbanski said, according to charging documents.

“What are you talking about?” Collins asked, according to Bender’s testimony.

Collins also said no, as if to stand his ground, and Urbanski stabbed him, Bender and Lee testified.

Prosecutors said Urbanski singled out Collins because of his race. They produced evidence that Urbanski had joined a white-supremacist Facebook group called “Alt-Reich: Nation” and downloaded several racist memes that demeaned African Americans and other minorities and endorsed violence against them. A childhood friend of Urbanski testified that he participated in group chats and joined the Facebook group.

“It’s no different than saying he was a member of the KKK,” Assistant State’s Attorney Jonathon R. Church told the court Tuesday. Church argued that when Urbanski gave the order to “step left,” it was because he intended to harm Collins.

Jurors had ample evidence to infer that the reason Urbanski bypassed two other people — a white man and an Asian woman — at the bus stop and attacked Collins was because Collins was black, Church said.

But John McKenna, one of Urbanski’s attorneys, argued that Collins was attacked instead of the others simply because he was the only one to engage Urbanski when he declined to step aside.

McKenna urged the judge to dismiss the hate crime count, arguing the state had failed to produce any additional context or background that could connect the social media to ­Urbanski’s actions that night. They argued that there was no evidence Urbanski had ever looked at the memes again after downloading them as far back as December 2016 and that the Facebook page had been created as a parody.

The defense also said the state could not produce any witness from Urbanski’s past who might testify that he advocated violence against minorities. And prosecutors did not produce a witness from Urbanski’s long night of drinking who could support the theory that Urbanski wanted to harm a black person that night, the defense said.

Defense lawyers argued instead that Urbanski was seething with self-loathing that night because he had left U-Md. and fallen behind former classmates who were partying ahead of graduation.