Soon after Seemona Sumasar started dating Jerry Ramrattan, she had an inkling that something might be wrong.

He said he was a police detective, but never seemed to go to work. He seemed obsessed with “C.S.I.,” “Law & Order” and other television police dramas.

About a year after he moved into her house in Queens, their relationship soured. One day, he cornered her, taped her mouth and raped her, she said. Mr. Ramrattan was arrested.

But he soon took his revenge, the authorities said. Drawing on his knowledge of police procedure, gleaned from his time as an informer for law enforcement, he accomplished what prosecutors in New York called one of the most elaborate framing plots that they had ever seen.