A Texas man who confessed to killing his neighbor avoided murder and manslaughter convictions after claiming that the killing was self defense because the man tried to kiss him.

James Miller, a former police officer, was sentenced Tuesday for the 2015 death of Daniel Spencer. Jurors found him guilty of criminally negligent homicide and he was sentenced the following day to 10 years probation and six months in jail, local NBC affiliate KXAN reported.

The 69-year-old Miller, who took up guitar after retiring, told police that in September, 2015 he was at Spencer's house playing music and drinking with his 32-year-old neighbor and saxophonist. Miller testified that Spencer tried to kiss him.

“We were playing back and forth and everything, and I just let him know – Hey, I'm not gay,” Miller said.

“When I got ready to go – it seemed like [expletive] just started happening.”

Miller went to the police and confessed to stabbing Spencer twice. “I think I killed someone. … I stabbed him,” he said, according to a police report obtained by the Austin American-Statesman.

Miller's “gay panic” defense worked and he avoided murder and manslaughter convictions. The judge in the case ordered Miller to complete 100 hours of community service, pay $11,000 in restitution to Spencer's family and placed him on probation for a decade.

D'Arcy Kemnitz, executive director of the LGBT Bar Association, called the defense “something from the very darkest of ages.”

“It's hard to believe that something like this exists,” Kemnitz told The Washington Post. “This is something from the very darkest of ages, based on the idea that if a gay guy hits on a straight guy, then the straight guy gets to do whatever he wants to do to him, including a homicide.”

Miller testified that he felt his neighbor was “going to hurt” him.

“He had height advantage over me, arm length over me, youth over me,” said Miller, who is at least eight inches shorter than Spencer was.

Prosecutor Matthew Foye disagreed, telling the court that Miller did not have “so much as a scratch on him.”

Only two states, California and Illinois, prohibit use of the “gay panic” defense.