Using knowledge he gleaned partly from watching crime dramas like CSI, the private detective, Jerry Ramrattan, orchestrated what prosecutors called one of the most elaborate framing schemes in recent history.
Ramrattan's former girlfriend, Seemona Sumasar, had accused him of raping her. After she refused to drop the rape charges, he concocted a scheme that landed her in jail for seven months, making it seem as though Ms Sumasar was the likely perpetrator of a series of armed robberies, for which she was accused of impersonating a police officer.
At his trial in State Supreme Court in Queens, prosecutors produced evidence that Ramrattan cajoled and extorted witnesses to testify falsely that she had robbed them. He even staged crime scenes, prosecutors said, in which he planted evidence, handcuffing one of Ms Sumasar's supposed victims to a pole and planting bullets at the scene of one of the imaginary crimes.
Before Ramrattan was sentenced, Ms Sumasar delivered a stinging victim impact statement, noting his lack of remorse as he stared ahead, stone-faced, while she spoke.
''I don't have words for you,'' she said. ''You are evil. You are a sociopath. The only thing that helps me sleep at night is that what happened to me was for a reason: someone needs to put a stop to your madness.''
During her seven months in jail, awaiting a robbery trial, Ms Sumasar, a former Morgan Stanley analyst, was separated from her young daughter. She lost her business, and her house went into foreclosure. Her bail was set at $US1 million, which she could not afford.
Ramrattan was free until an informer came forward late in 2010 and exposed his ruse.
He was convicted in November of a series of charges, including rape, conspiracy and perjury.
The trial offered two opposing plot lines that were seemingly irreconcilable. Prosecutors characterised Ms Sumasar as a single mother charmed by a conman who ruined her life; the defence portrayed her as a scorned woman who falsely accused her former boyfriend of rape after the relationship soured.
Members of the jury said the guilty verdict hinged on the jury's belief that Ramrattan had raped Ms Sumasar, giving him a motive to set his plot in motion.
In his plea for leniency, Ramrattan insisted that he was innocent, saying that he had spent years helping the police solve cases as an informer.
But Justice Richard Buchter said he deserved no mercy, calling him a ''diabolical conniver who shamelessly exploited the criminal justice system''.
The Queens District Attorney's Office and the Nassau County District Attorney's Office had insisted on Ms Sumasar's guilt until she was freed weeks before her robbery trial was to begin.
Legal experts said the case was a cautionary tale that illustrated the ease with which the justice system could be manipulated by someone who understood police procedure and was adept at telling lies.
Judge Buchter said: ''The police were duped by liars by whom they had a right to be suspicious, and as a result a rape victim was framed by her rapist. She was victimised by the rapist and then again by the criminal justice system.''
He also said: ''The defendant is the architect of his own ruin. He deserves no mercy from me, and he won't get any.''
Last month Ms Sumasar filed a civil suit against the New York Police Department and the Nassau County Police Department. In the lawsuit, she says New York police officers protected Ramrattan because he was working as an informer.
The New York Times