It was an explosive moment. Mr. Carson, 32, was a Brooklyn native, outgoing and proudly open about his sexuality, who worked at a gelato kiosk in Grand Central Terminal. Mr. Morales was from the Lower East Side of Manhattan, unemployed, broke and sleeping on a friend’s couch in Queens. He was armed with a .38-caliber revolver he said he wanted to sell. He had served 11 years in prison for a robbery during which three women were bound with duct tape, choked and assaulted with a pipe.

Spewing antigay insults, Mr. Morales dared Mr. Carson and Mr. Robinson to come around the corner onto Eighth Street to settle their differences, Mr. Robinson testified. They followed him, thinking it was a bluff.

There, just after midnight on May 18, 2013, in the shadow of a closed bookstore, Mr. Morales shot Mr. Carson while Mr. Robinson was on the telephone with the police, witnesses said.

“This was bigotry, and this was unjustifiable rage,” the lead prosecutor, Shannon Lucey, said in her summation. “The defendant was able to shoot Mark Carson over nothing because Mark Carson was nothing to the defendant. Mark Carson was nothing to the defendant but a subhuman fag.”

In his testimony, Mr. Morales said that he had had sexual relationships with transgender women; he called one of his longtime sexual partners as a witness. “I, Elliot Morales, am not a bigot,” he said. “I don’t hate gays.”

But Ms. Lucey noted that he never took transgender women he slept with on dates or walked in public with them. “The defendant is self-loathing; he wants no one to know or to see who he is,” she said. “He has a lot of self-loathing issues, and that came out when he saw Mark Carson and Danny Robinson being who they are.”