This study delves into the influence of positivism on Portuguese criminal law between 1852 and 1936, particularly concerning the treatment of dangerous offenders, specifically those who are insane. The positivist doctrine challenged the classical notion of criminal justice based on free will, asserting that offenders are abnormal individuals, influenced by physical, anthropological, and social factors. The text examines the evolution of medical-psychiatric research and the positivist understanding of criminal justice, highlighting the shift towards treating dangerous offenders through security measures. The legal response to insane offenders, criminal responsibility, serving prison sentences, and the treatment of other classes of offenders is explored within this positivist framework, emphasizing the interplay between mental abnormality, criminal acts, and social defence strategies.