detective (n.)
"one whose occupation is to investigate matters as to which information is desired, especially concerning wrong-doers, and to obtain evidence against them," 1828, short for detective police, from detective (adj.) "fitted for or skilled in detecting" (by 1828); see detect + -ive.
His duties differ from those of the ordinary policeman in that he has no specific beat or round, and in that he is concerned with the investigation of specific cases, or the watching of particular individuals or classes of offenders, rather than with the general guardianship of the peace, and does not wear a distinguishing uniform. [Century Dictionary, 1897]