The killing looked like a hate crime.

The victim was Michael Sandy, a gay, black 28-year-old. The suspects were a group of young whites who ran out of money and drugs on a Sunday night and figured a gay man would be an easy mark for a robbery.

Police said the men, using an online chat room, lured Sandy to a remote New York City beach by promising a date, then beat him and chased him into the path of a speeding car. Mayor Michael Bloomberg called the crime "a pernicious scheme" to single out a victim because of his sexual orientation. Prosecutors filed murder and hate crimes charges.

But a trial has produced a surprise: The man who first suggested going after a gay target was probably gay too.

Taking the stand in his own defense, Anthony Fortunato testified about having a series of one-night stands with men he met online. He said he had been having homosexual impulses since he was around 13, although he kept that hidden from friends.

"I was living two complete double lives," said Fortunato, 21. When asked directly about his sexual orientation, he said, "I don't know. I could be homosexual. A homosexual. Bisexual."

The revelation — corroborated by three men who testified that they had sexual encounters with Fortunato — was intended to question the validity of charging him with a hate crime, an offense that could add years to his prison sentence if he is convicted.

Defense attorney Gerald Di Chiara said his client clearly had no hatred for gays.

Fortunato, one of four men charged in the assault, acknowledged that it was his idea to enter an online chat room and find a gay man to set up.

But he said the plan had been to try to trick Sandy into giving them marijuana or money — not to attack him.

Prosecutors argue that Fortunato's sexual orientation is irrelevant.

Under New York law, they said, defendants can be convicted of a hate crime even if they bear no actual hatred for their victim.

The law requires only that they have singled out a person for a violent act because of some belief or stereotype about that person's ethnicity, gender, religion, age, disability or sexual orientation.

The judge overseeing the case backed that interpretation of the law before trial.

"This is a case where the defendants deliberately set out to commit a violent crime against a man whom they intentionally selected because of his sexual orientation," wrote state Supreme Court Justice Jill Konviser.

Legal scholars also said the law appears to be on the prosecution's side.

One legal expert said it would not be unheard of for a gay person to lash out in hatred at another gay person.

Research has suggested that at least some violent gay bashing is committed by people who are sexually confused themselves, said Ruthann Robson, a professor at the City University of New York School of Law whose specialties include gay sexuality and the law.

"It's self-hatred," Robson said. "That doesn't meant that they should be allowed to act out and hurt other people because they are confused about their sexuality."

Fortunato and one of his co-defendants, John Fox, are charged with a range of crimes. Closing arguments at their trial were scheduled for Wednesday and Thursday.

Jurors could convict them of murder or the lesser charge of manslaughter, or of only robbery and assault. On each count, the jury also has the option of convicting the pair of a hate crime, which would enhance any prison sentence, especially on the lesser charges. They face at least 25 years to life in prison if convicted of murder.

Another man accused of participating in the attack, Ilye Shurov, is to be tried separately. A fourth man, Gary Timmins, who was 16 at the time of the killing, pleaded guilty to attempted robbery and testified for prosecutors.