'Egregious’ conduct by government investigator violated Gurpreet Singh’s right to fair treatment, judge rules.