A bisexual man convicted of murder as a hate crime for shooting a gay man he taunted on a New York City street was sentenced Tuesday to 40 years to life in prison, with the judge making a reference to the shooting attack at a gay nightclub in Florida.

A Manhattan jury had convicted Elliot Morales in the May 2013 shooting of Mark Carson in the Greenwich Village neighborhood, a center of American gay life for decades.

Prosecutors said Morales had issues with his own sexuality and was jealous that Carson and his roommate were openly gay. He yelled anti-gay slurs at the men before shooting Carson in the face at close range.

Arrested moments later, Morales began laughing and admitted killing Carson as officers held him down.

“Diagnosis dead, doctor,” he is heard shouting on an officer’s video.

At the sentencing, Judge A Kirke Bartley talked about the Orlando shooting, where 49 people were killed, which he said was a parallel to Morales’ crime. “That parallel is revealed in hate, self-loathing, fear and death,” he said.

He characterized Morales as “a monster” and said: “Yours is a legacy of death and fear, nothing more, nothing less.”

Morales, who represented himself in court, said he acted in self-defense and couldn’t be guilty of a hate crime because he is bisexual. His star witness was a transgender woman who testified that she was his ex-lover.

As he cross-examined Carson’s former roommate at trial, Morales blamed the two men for the conflict that led to the shooting and suggested they should have ignored the taunts and walked away.

In his closing argument, he wept and told jurors that he was “not a bigot of any type” and that charging him with a hate crime was “ridiculous”.

The shooting happened a few blocks from the Stonewall Inn, the site of 1969 riots that helped give rise to the gay rights movement.

“Any life lost to gun violence is a tragedy for our city,” Manhattan district attorney Cyrus R Vance Jr said in a statement. “But homophobic, hate-fueled incidents like this one are particularly unconscionable. As we mourn the lives lost in Orlando, we remain committed to doing everything we can to combat and prevent crimes against LGBT New Yorkers.”