Based on new archival material, mainly police and judicial records and court sentences from the late 1940s, this article examines the legal and political background of the trials against homosexuals in post-revolutionary and early socialist Yugoslavia. During those years, at least two hundred men were convicted on prison terms for ‘unnatural fornication’ and some four hundred more were arrested and detained in police stations with their names entered into police registries. The year 1949 was particularly harsh for homosexuals in Yugoslavia. Two major anti-homosexual trials were held in Dubrovnik and Zagreb, when groups of homosexual men were accused of creating hotbeds of vice and debauchery. Perceived as a threat to the youth and their socialist upbringing, homosexuals were condemned as not only criminals but also renegades of the new socialist order and in some cases even as its saboteurs. Verdicts expressed a glaring ideological prejudice rooted in the notion that homosexuality was an expression of class exploitation, petty-bourgeois individualism and a visible sign of degeneration inherited from the old regime. The proper moral and sexual development of the youth, the first generation of the new socialist men and women, was consistently at the forefront of the reasoning behind guilty verdicts. This paper offers new insights into the legal history of homosexuality in Yugoslavia and contributes to the historiographical interpretation of ideological and political underpinnings surrounding homosexuality in early socialist regimes across Central and Eastern Europe.