Robert Stolarik for The New York Times

A 30-year-old man who confessed to the 2008 baseball-bat murder of a 31-year-old Ecuadorean immigrant by saying, “So I killed someone — that makes me a bad guy?” was sentenced on Thursday to more than 30 years in prison.

The defendant, Keith Phoenix, was convicted in May of attacking José O. Sucuzhañay on a street corner in Bushwick, Brooklyn, after Mr. Phoenix and another man, Hakim Scott, 27, jumped out of their sport utility vehicle, yelling slurs at Mr. Sucuzhañay and his brother, Romel Sucuzhañay.

Prosecutors said that the two assailants pounced on the Sucuzhañays because they were Hispanic and because Mr. Phoenix and Mr. Scott suspected they were gay.

Justice Patricia M. DiMango of State Supreme Court in Brooklyn sentenced Mr. Phoenix, who was convicted in June of murder and assault as hate crimes, to 37 years to life in prison. She sentenced Mr. Scott, who was convicted of manslaughter and assault but cleared of more serious hate-crime charges, to 37 years.

Both defendants had pleaded for leniency, Mr. Phoenix in a statement read by his lawyer, Mr. Scott in one he read himself. Mr. Scott urged the judge to treat them separately and not let Mr. Phoenix’s case affect his sentence.

Robert Stolarik for The New York Times

“I feel a certain amount of comfort that there is a law and there will be justice, the Sucuzhanays’ mother, Julia Quintuna, said through an interpreter before the hearing in Justice DiMango’s courtroom. After the sentencing, Ms. Quintuna said, “This is a very sad day. It’s sad for my family and for the family of the defendants. I feel very sorry for the defendants, and of course there is a huge emptiness in my heart because of my son.”

Mr. Phoenix, who was arrested nearly three months after the crime as he hid in the bathroom of an apartment in Yonkers, was tried twice. His first trial, in May, ended with the jury deadlocked. When he was arrested, Mayor Michael R. Bloomberg and Police Commissioner Raymond W. Kelly said that he showed no remorse.

The Sucuzhañays were walking home from a church party and a stop at a bar, arm in arm. José Sucuzhanay’s girlfriend was with them.

Mr. Phoenix and Mr. Scott, along with a third man, Demetrius Nathaniel, were driving home from another party and had stopped at a traffic light where the Sucuzhañays were crossing the street. Mr. Phoenix yelled an antigay slur from behind the wheel. Testimony at Mr. Phoenix’s first trial indicated that the Sucuzhanays responded by kicking Mr. Phoenix’s sport utility vehicle.

Mr. Scott bolted out, slammed a beer bottle against José Sucuzhañay’s head and knocked him down, according to testimony. Wielding the broken bottle, Mr. Scott ran after Romel Sucuzhañay while Mr. Phoenix jumped out and grabbed an aluminum bat from the back of the S.U.V. and beat José Sucuzhañay.

Mr. Phoenix said in his videotaped confession in 2008 that he had reached for the bat because he believed that José Sucuzhañay was pulling out a handgun.

Romel Sucuzhañay, who suffered relatively minor injuries from the bottle, testified in April that he had moved back to Ecuador because of “what happened to my brother.” As he left the courtroom on Thursday, he said he would not comment on the sentences, saying the hearing had brought back the too many memories.

“My future future is in pieces,” he said. “I have mental problems. And it is all because of the ignorance of these people and this distant event.”