A federal appeals court says a former New York City police officer committed no crime when he fantasized online about committing horrific acts of sexual violence against his wife and others.

The 2nd U.S. Circuit Court of Appeals in a 2-to-1 ruling Thursday said a lower-court judge correctly reversed a jury verdict against Gilberto Valle (VAL'-ee).

The majority decision written by Circuit Judge Barrington Parker said the court is "loathe to give the government the power to punish us for our thoughts and not our actions."

The 2nd Circuit said fantasizing about committing a crime of violence against a real person whom you know is not a crime.

Circuit Judge Chester Straub dissented, saying he would reinstate the conviction. Messages to lawyers were not immediately returned.