New York's so-called "cannibal cop" was cleared of all charges by a divided U.S. appeals court on Thursday, more than two years after a jury convicted him of plotting to kill and eat women.

Former New York City Police Officer Gilberto Valle was found guilty at trial in March 2013 of conspiring to kidnap women and illegally accessing a police database to collect information on potential victims.

But the trial judge last year threw out his conviction on the conspiracy charge, a decision that the 2nd U.S. Circuit Court of Appeals in New York affirmed on Thursday in a 2-1 ruling.

"This is a case about the line between fantasy and criminal intent," Circuit Judge Barrington Parker wrote for the majority. "Fantasizing about committing a crime, even a crime of violence against a real person whom you know, is not a crime."

RELATED: 'Cannibal cop' cries during wife's testimony

The appeals court also vacated Valle's conviction for using the database, finding that federal law does not prohibit individuals from accessing a computer they are normally authorized to use, even if they do so for an improper purpose.

In a sharply worded dissent, Circuit Judge Chester Straub said Valle should be convicted of both charges.

"It was, and remains, for the jury to determine the factual question of whether Valle had criminal intent," he wrote. "The jury considered and rejected Valle’s defense that he was simply pretending to commit a crime."

A spokesman for Preet Bharara, the U.S. Attorney in Manhattan, did not immediately comment. Valle's appellate lawyer was not immediately available for comment.

RELATED: 

The trial provided a rare glimpse of a dark corner of the Internet, where like-minded fetishists trade explicit materials and discuss violent fantasies. It also raised a difficult legal question: when does a person's fantasizing about committing a crime cross the line into actual criminal conduct?

Valle was not accused of harming any women. Instead, prosecutors said he discussed with other online enthusiasts his intention to abduct, torture, cook and eat women.

Prosecutors said he took concrete steps to put his plans into action, including looking up women's information in the database and researching chloroform recipes.

But Valle's lawyers argued that those acts were part of his fetish and that he never intended to commit an actual crime.

A number of privacy advocacy groups, including the Electronic Frontier Foundation, filed friend-of-the-court briefs, warning that convicting Valle would violate the constitutional right to free speech.