A man is facing the rest of his life behind bars for knifing a man to death in Brooklyn after meeting him on a gay hook-up app called Jack’d.

The alleged killer, though, had no idea the victim was also under investigation for sex assault.

In April, David Haigh of Pennsylvania traveled to Brooklyn to meet James Johnson. The pair met through an online dating and chat app called “Jack’d.

But Haigh, 42, was unaware that the 41-year-old Johnson was under investigation by the NYPD for criminal sex act charges stemming from an attack nine days before, its reported.

James Johnson, 41, was also under investigation for sex assault.

“An unnamed victim indicated that what started out as a consensual encounter with Johnson quickly turned into a nightmare,” according to a motion filed by Haigh’s defense attorney, Thomas Andrykovitz, requesting bail be considered.

https://www.facebook.com/Kriotto?lst=100005295222868%3A1019320825%3A1491914975

Haigh (pictured) said he felt threatened, and he admitted to repeatedly stabbing Johnson.

On the weekend Haigh was hanging out with Johnson, the men went back to his Fort Greene apartment. At some point, Haigh felt threatened, and he admitted to repeatedly stabbing Johnson in his chest and body, according to the criminal complaint.

Prosecutors charged him with second-degree murder and criminal possession of a weapon. If convicted, he faces 25 years to life in prison.

You might be interested in: Chemsex: the Rise of Party and Play