The history of lesbian, gay, bisexual and transgender people (LGBT) in Russia and its historical antecedents (the Soviet Union and the Russian Empire) has largely been influenced by the political leanings of its rulers. Medieval Catholic-Protestant Europe had the largest influence on Russian attitude towards homosexuality. Russian LGBT history was influenced by the ambivalent attitude of the Russian Orthodox religiosity regarding sexuality. Homosexuality has been documented in Russia for centuries. Medieval Russia was apparently very tolerant of homosexuality, with foreign visitors to the country surprised by displays of affection between homosexuals. The earliest documented bans on homosexuality date to the early-mid 17th century, during the reign of Tsar Alexis Mikhailovich, who began the process of the Europeanization and modernization of Russia. Under the reign of Peter the Great in the 18th century, who introduced a wide range of reforms aimed at modernizing and Westernizing Russia, male homosexual activity was banned only for soldiers in military statutes. In 1832, the criminal code included Article 995, which stated that "muzhelozhstvo", or men lying with men, was a criminal act punishable by exile to Siberia for up to 5 years. Men lying with men was interpreted by courts as meaning anal sex. Application of the laws was rare, and the turn of the century found a relaxation of these laws and a general growing of tolerance and visibility. In the wake of the October Revolution, the Bolshevik regime decriminalized homosexuality. The Bolsheviks rewrote the constitution and "produced two Criminal Codes – in 1922 and 1926 – and an article prohibiting homosexual sex was left off both." The new Communist Party government removed the old laws regarding sexual relations, effectively legalising homosexual and transgender activity within Russia, although it remained illegal in other territories of the Soviet Union, and the homosexuals in Russia were still persecuted and sacked from their jobs. Under Joseph Stalin, the Soviet Union recriminalized homosexuality in a decree signed in 1933. The new Article 121, which punished "muzhelozhstvo" with imprisonment for up to 5 years, saw raids and arrests. Female homosexuals were sent to mental institutions. The decree was part of a broader campaign against "deviant" behavior and "Western degeneracy". Following Stalin's death, there was a liberalisation of attitudes toward sexual issues in the Soviet Union, but homosexual acts remained illegal. Discrimination against LGBT individuals persisted in the Soviet era, and homosexuality was not officially declassified as a mental illness