Prosecutors and defense attorneys agree that Sean Urbanski killed Richard Collins III as the two men waited at a bus stop at the University of Maryland in the days before graduation. But both sides presented starkly contrasting motives in the fatal stabbing of the black Army lieutenant, who was killed at a time of heightened racial tension on the College Park campus.

Urbanski, who is white, had filled his mind with images that demeaned African Americans, and he killed the only black person at the bus stop in a race-fueled attack, prosecutors said in opening statements Wednesday at Urbanski’s trial in Prince George’s County Circuit Court.

“He poisoned his mind,” Principal Deputy State’s Attorney Jason Abbott told jurors. Stifled gasps went around the courtroom when Abbott shared an image of a racist meme and slur found on Urban­ski’s phone that described the pleasure of seeing a black person stuffed into a wood chipper.

Attorneys for Urbanski, 24, of Severna Park, acknowledge that he killed Collins. But in a bid to secure a conviction less serious than first-degree murder and to avoid his being found guilty of a hate crime, they argued that their client acted on an alcohol-fueled impulse. The state’s case, Urban­ski’s lawyers argued, amounted to sheer speculation about motive based on a handful of vile memes pulled from about 17,000 images on Urbanski’s phone.

“This case is an unspeakable tragedy for all concerned,” William C. Brennan Jr., one of Urbanski’s attorneys, told the jury, accusing prosecutors of “using race to divide the community.”

The jury — 16 people, including four alternates — is majority African American.

Two years after Collins’s killing, the panel heard the opening statements in a packed courtroom. Collins’s mother sank against her husband’s shoulder and wept as the trial got underway. A young woman sitting with Urbanski’s family on the opposite side of the courtroom dabbed at tears when he entered.

Several people in the courtroom on the Collins family side wore black-and-white buttons with the words “Love Not Hate” and two wore bright yellow T-shirts that read “Justice for Richard.” Before breaking for lunch, the judge advised spectators against any emotional outbursts and directed those with visible mes­sages of any kind to conceal them or face possible expulsion from the courtroom. After the lunch break, the yellow T-shirts had been turned inside out, and the buttons had been removed.

Surveillance cameras captured glimpses of what the defendant and the victim were doing in the hours leading up to their fatal confrontation and the crime itself. But the trial is expected to focus more on what Urbanski was thinking rather than what he did.

Urbanski and Collins each had been drinking with friends on the night of May 20, 2017, prosecutors said. Collins, a 23-year-old ROTC student who had received his commission as a second lieutenant in the Army a week or so earlier, was a few days from receiving his degree in business at Bowie State University. It was a festive time on both campuses as students prepared for graduation ceremonies.

About 3 a.m., Collins, with two friends, was waiting for an Uber at a bus stop on the U-Md. campus.

Urbanski, a former U-Md. student, came upon the group. He was screaming, but no one could make out what he was saying, Brennan said.

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

“No,” Collins replied, according to the documents.

Urbanski attacked him, severing Collins’s pulmonary artery with a single thrust of the knife, prosecutors said, and the knife later was found in his pants pocket.

Cpl. Thomas Kelley, a Prince George’s County patrol officer who responded to scene, testified that he saw Urbanski sitting at the bus stop about 100 feet from Collins. Urbanski approached the officer, yelling incoherently, before Kelley ordered him to sit back down.

Prosecutors argued that Urbanski targeted Collins because his mind was filled with racist hatred.

At the bus stop, Urbanski stood off to the side and watched Collins talking with others for some time, prosecutors said. Urbanski left but later returned, confronting the group. He then bypassed a white man and an Asian woman before attacking Collins, who had his hands in his pockets, Abbott said.

Defense lawyers said Urbanski was raving drunk and might have attacked anybody in his way. They say that the material on his phone is undoubtedly hateful but that there’s no evidence it’s directly connected to what they deem Urbanski’s impulsive actions that night.

Urbanski’s attorneys said their client never advocated for violence against black people or other minorities, never issued any hateful manifesto, never demonstrated racism against anyone. And, Brennan said, Urbanski was too drunk that night to form any discernible motive. He suggested that Urbanski, who had lashed out at a sign with his fists earlier that night, was primed to attack anyone.

While questioning Cpl. Garfield Kelly, who was the lead detective from the U-Md. campus police, defense attorney John M. McKenna attempted to elicit evidence showing that Urbanski was mindlessly drunk.

McKenna asked whether, after Urbanski was detained, he was singing in the cell, urinating in a drain, and asking police why he was there and whether he could go home.

Isn’t it true, McKenna asked, that when the detective told the suspect that he had killed someone, Urbanski began to cry?

“Objection,” one of the prosecutors said, and the corporal never answered.

Collins’s killing occurred at a time when campuses around the country, including U-Md., were experiencing a surge in racist incidents documented by the ­Anti-Defamation League and others. That August, white supremacists and neo-Nazis paraded with torches at the University of Virginia in Charlottesville on a weekend that ended in violent clashes downtown and the killing of counterprotester Heather Heyer.

Urbanski must be convicted of murder or manslaughter to be convicted of a hate crime. If convicted of first-degree murder, he could face life in prison without parole.

Law enforcement officials initially said there was no evidence a hate crime had occurred. But police said later that Urbanski had some connection to “Alt-Reich: Nation,” a Facebook page — since deleted — that police said trafficked in racist themes. Law enforcement, with the assistance of the FBI, dug into Urbanski’s electronic gadgetry and social media postings and found memes expressing violent hostility toward African Americans and other racist material, according to prosecutors.

Defense lawyers have suggested that Urbanski’s relationship to the offensive material is unclear and tenuous. They cite a New York Times interview with the Facebook page’s creator saying the Alt-Reich site had been intended as satire.