"An unnatural sex act committed between persons of the male sex or by humans with animals is punishable by imprisonment; the loss of civil rights may also be imposed." (Paragraph 175, German Penal Code, 1871)

The statute of Paragraph 175 was amended several times. The Nazis broadened the law in 1935 and increased its prosecutions by an order of magnitude; thousands died in concentration camps, regardless of guilt or innocence. East Germany reverted to the old version of the law in 1950, limited its scope to sex with youths under 18 in 1968, and abolished it entirely in 1988. West Germany retained the Nazi-era statute until 1969, when it was limited to "qualified cases"; it was further attenuated in 1973 and finally revoked entirely in 1994 after German reunification.

Paragraph 135 of the German criminal code was adopted by the German Empire on 15 May, 1871, shortly after the Empire's unification in January, 1871. It remained part of German law until it was abolished by the Federal Republic of Germany on March 10, 1994. An estimated number of 140,000 men were convicted based on this Paragraph during the 123 years of its enforcement.

Paragraph 175 targeted homosexual men, but not homosexual women (lesbians). In 1907, a law was drafted that would persecute lesbians as well, but the Reichstag (Parliament) rejected this proposal.

From 1935 to 1945, the Gestapo were authorized to arrest and imprison suspected offenders of Paragraph 175. Several of the imprisoned suspects had either never received a formal trial, or had previously been acquitted in court.

Following World War II, there were varying approaches to Paragraph 175 in East and West Germany. In 1950, East Germany decided to abolish the Nazi-era amendments to Paragraph 175, and to restore the form of the Paragraph that was used by the Weimar Republic (1918-1933). West Germany decided to keep the Nazi-era amendments, until modifying the Paragraph in 1969.

Paragraph 175 in its 1871 form was largely based on Paragraph 143 of the 1794 Prussian criminal code. According to the relevant law from 1794: "Unnatural fornication, whether between persons of the male sex or of humans with beasts, is punished with imprisonment of six months to four years, with the further punishment of a prompt loss of civil rights." Several other German states had less severe persecution of homosexuality. Bavaria had abolished the persecution of homosexuality back in 1813, due to copying France's Revolutionary Penal Code of 1791. The French Code had legalized consensual homosexual sex, but persecuted non-consensual acts of homosexuality (male-on-male rape).

The Nazi Party rose to power in Germany in 1933. Four years earlier, in 1929, there was a campaign in the German Reichstag (Parliament) to abolish Paragraph 175. The proposal for abolition was supported by a loose alliance between the Social Democratic Party of Germany, the Communist Party of Germany, and the German Democratic Party. Despite the proposal winning the majority of votes in the Reichstag, the Reichstag failed to draft a new law to replace Paragraph 175.

In 1935, the Nazi Party enacted two major modifications of Paragraph 175. Previously the maximum penalty for homosexual activity was 6 months imprisonment, but the 1935 amendment expanded it to 5 years of the imprisonment. The Weimar-era wording of the Paragraph required "penetrative intercourse", but the 1935 amendment also banned homosexual activities where there was no actual physical contact.

According to statistics from the Nazi era, only about 50% of those arrested for homosexual activity were brought to the attention of authorities by police officials. 40% were arrested after the authorities received information on them by non-participating observers of the sex crimes, and 10% were reported to the authorities by their employers or by institutions which they were affiliated with.

Of the pink-triangle prisoners send to the Nazi concentration camps due to Paragraph 175, an estimated 10,000 men managed to survive to the end of World War II. Several of them were later transferred from the concentration camps to regular prisons, where they continued to serve their sentences.

East Germany stopped enforcing Paragraph 175-persecutions in 1957, because most of them were reclassified from felonies to misdemeanors. In 1968, it modified its version of Paragraph 175 to specifically target statutory rape cases, involving homosexual acts between an adult male and a boy under the age of 18, or an adult woman and a girl under the age of 18.

In 1987, the Supreme Court of East Germany found Paragraph 175 (which had been renamed to Paraghaph 151 by this point) to be unconstitutional, because "homosexuality, just like heterosexuality, represents a variant of sexual behavior. Homosexual people do therefore not stand outside socialist society, and the civil rights are warranted to them exactly as to all other citizens." A reform of the law codes of East Germany in 1988 suggested the decriminalization of homosexuality and the abolition the Paragraph. The formal abolition of the Paragraph took place on 30 May, 1989.

The conservative West Germany continued enforcing the Nazi-era version of Paragraph 175 until 1969. An estimated 100,000 men were indicted from 1945 to 1969, and about 50,000 of them were convicted in court. However, it was noted that several of them never served their sentences. Some fled to foreign countries which tolerated homosexuals (such as Switzerland), and others chose to commit suicide instead of serving prison time.

Both Nazi Germany and West Germany rejected efforts to fully criminalize female homosexuality (lesbianism), using the legal argument that "because all men were more aggressive and predatory than women, lesbianism would not be criminalized. While lesbianism violated nature, it did not present the same threat to society as did male homosexuality."

In 1969, West Germany modified its version of Paragraph 175, decriminalizing most homosexual acts. Under the 1969 amendment, the only acts which remained criminal were "sex with a man less than 21 years old, homosexual prostitution, and the exploitation of a relationship of dependency (such as employing or supervising a person in a work situation)". In 1973, the Paragraph was modified again, lowering the age of consent from age 21 to age 18.

In 1986, the German Green Party started a formal campaign in parliament to fully abolish Paragraph 175 in West Germany. The proposal was defeated, because the Greens were the only parliamentary party which supported it.

East Germany and West Germany were formally unified into a single German state in 1990, but debate over how to integrate their different legislations continued until 1994. Part of the debate was whether to extend West Germany's version of Paragraph 175 to East Germany, which had rejected and abolished the Paragraph in the 1980s. It was finally decided to abolish the Paragraph completely and to have the age of consent for homosexual sexual activity lowered from age 18 to age 14. The minimum age of consent (at 14) matched the age of consent for heterosexual sexual activity.

In 2002, the Bundestag (Federal Parliament) of Germany formally annulled all convictions of Paragraph 175-related sex crimes performed during the Nazi era (1933-1945) and in effect pardoned the convicts (most of them posthumously). However it declared the convictions from 1945 to 1969 to still be part of the formal record, despite being based on a Nazi-era law. In 2016 and 2017, the Federal Ministry of Justice declared those convictions to have been illegal as well, and offered formal pardons to either the surviving former convicts or to their surviving family members.

The British equivalent of Paragraph 175 was the so-called Labouchere Amendment of 1885, which targeted male homosexuals for imprisonment, but de facto decriminalized female homosexual activity (lesbianism). The Amendment remained in force from 1885 to 1967. Male homosexuality was decriminalized in England and Wales in 1967, decriminalized in Scotland in 1981, and decriminalized in Northern Ireland in 1982.