ref
mid 19th century: from detect. The noun was originally short for detective policeman, from an adjectival use of the word in the sense ‘serving to detect’.