Miguel Primo de Rivera
In 1822, the Kingdom of Spain's first penal code was adopted and same-sex sexual intercourse was legalised. In 1928, under the dictatorship of Miguel Primo de Rivera, the offense of "habitual homosexual acts" was recriminalised in Spain.