A court has ruled that giving a police officer the finger is protected by the First Amendment as free speech.