Societal attitudes towards same-sex relationships have varied over time and place, from requiring all males to engage in same-sex relationships, to casual integration, through acceptance, to seeing the practice as a minor sin, repressing it through law enforcement and judicial mechanisms, and to proscribing it under penalty of death. In a 1976 study, Gwen Broude and Sarah Greene compared attitudes towards and frequency of homosexuality in the ethnographic studies available in the Standard cross-cultural sample. They found that out of 42 communities: homosexuality was accepted or ignored in 9; 5 communities had no concept of homosexuality; 11 considered it undesirable but did not set punishments; and 17 strongly disapproved and punished. Of 70 communities, homosexuality was reported to be absent or rare in frequency in 41, and present or not uncommon in 29.
It was accepted in some forms in ancient Greece. However, in later cultures influenced by Abrahamic religions, the law and the church established sodomy as a transgression against divine law or a crime against nature.
Many male historical figures, including Socrates, Lord Byron, Edward II, and Hadrian, have had terms such as gay or bisexual applied to them; some scholars, such as Michel Foucault, have regarded this as risking the anachronistic introduction of a contemporary social construct of sexuality foreign to their times, though others challenge this.
A common thread of constructionist argument is that no one in antiquity or the Middle Ages experienced homosexuality as an exclusive, permanent, or defining mode of sexuality. John Boswell has countered this argument by citing ancient Greek writings by Plato, which describe individuals exhibiting exclusive homosexuality.
Among Indigenous peoples of the Americas prior to European colonization, a number of Nations had respected ceremonial and social roles for homosexual, bisexual, and gender-nonconforming individuals in their communities; in many contemporary Native American and First Nations communities, these roles still exist. While each Indigenous culture has their own names for these individuals, a modern, pan-Indian term that was adopted in 1990 is "Two-Spirit". While this new term has not been universally accepted—it has been criticized by traditional communities who already have their own terms for the people being grouped under this "urban neologism", and by those who reject what they call the "western" binary implications, such as implying that Natives believe these individuals are "both male and female", it has generally met with more acceptance than the anthropological term it replaced.
Homosexual and gender-variant individuals were also common among other pre-conquest civilizations in Latin America, such as the Aztecs, Mayans, Quechuas, Moches, Zapotecs, and the Tupinambá of Brazil.
The Spanish conquerors were horrified to discover sodomy openly practiced among native peoples, and attempted to crush it out by subjecting the berdaches (as the Spanish called them) under their rule to severe penalties, including public execution, burning and being torn to pieces by dogs.
In East Asia, same-sex love has been referred to since the earliest recorded history.
Homosexuality in China, known as the pleasures of the bitten peach, the cut sleeve, or the southern custom, has been recorded since approximately 600 BCE. These euphemistic terms were used to describe behaviors, not identities (recently some fashionable young Chinese tend to euphemistically use the term "brokeback," 斷背 duanbei to refer to homosexual men, from the success of director Ang Lee's film Brokeback Mountain). The relationships were marked by differences in age and social position. However, the instances of same-sex affection and sexual interactions described in the classical novel Dream of the Red Chamber seem as familiar to observers in the present, as do equivalent stories of romances between heterosexual people during the same period.
Homosexuality in Japan, variously known as shudo or nanshoku, has been documented for over one thousand years and had some connections to the Buddhist monastic life and the samurai tradition. This same-sex love culture gave rise to strong traditions of painting and literature documenting and celebrating such relationships.
Similarly, in Thailand, kathoey, or "ladyboys," have been a feature of Thai society for many centuries, and Thai kings had male as well as female lovers. While kathoey may encompass simple effeminacy or transvestism, it most commonly is treated in Thai culture as a third gender. They are generally accepted by society, and Thailand has never had legal prohibitions against homosexuality or homosexual behavior.
The earliest Western documents (in the form of literary works, art objects, and mythographic materials) concerning same-sex relationships are derived from ancient Greece.
The formal practice, an erotic yet often restrained relationship between a free-born (i.e. not a slave or freedman) adult male and a free-born adolescent, was valued for its pedagogic benefits and as a means of population control, though occasionally blamed for causing disorder. Plato praised its benefits in his early writings but in his late works proposed its prohibition. In the Symposium (182B-D), Plato equates acceptance of homosexuality with democracy, and its suppression with despotism, saying that homosexuality "is shameful to barbarians because of their despotic governments, just as philosophy and athletics are, since it is apparently not in best interests of such rulers to have great ideas engendered in their subjects, or powerful friendships or physical unions, all of which love is particularly apt to produce".
Aristotle, in his Politics, dismissed Plato's ideas about abolishing homosexuality (2.4); he explains that barbarians like the Celts accorded it a special honour (2.6.6), while the Cretans used it to regulate the population (2.7.5).
Little is known of female homosexuality in antiquity. Sappho, born on the island of Lesbos, was included by later Greeks in the canonical list of nine lyric poets. The adjectives deriving from her name and place of birth (sapphic and lesbian) came to be applied to female homosexuality beginning in the 19th century. Sappho's poetry centers on passion and love for various personages and both genders. The narrators of many of her poems speak of infatuations and love (sometimes requited, sometimes not) for various females, but descriptions of physical acts between women are few and subject to debate. There is no evidence that she ran an academy for girls.
In ancient Rome, the young male body remained a focus of male sexual attention, but relationships were between older free men and slaves or freed youths who took the receptive role in sex. The Hellenophile emperor Hadrian is renowned for his relationship with Antinous. However, by 390 A.D., Emperor Theodosius I made homosexuality a legally punishable offense for the passive partner: "All persons who have the shameful custom of condemning a man's body, acting the part of a woman's to the sufferance of alien sex (for they appear not to be different from women), shall expiate a crime of this kind in avenging flames in the sight of the people." In 558, toward the end of his reign, Justinian expanded the proscription to the active partner as well, warning that such conduct can lead to the destruction of cities through the "wrath of God". Notwithstanding these regulations, taxes on brothels of boys available for homosexual sex continued to be collected until the end of the reign of Anastasius I in 618.
Through the medieval period, homosexuality was generally condemned and thought to be the moral of the story of Sodom and Gomorrah. Historians debate if there were any prominent homosexuals and bisexuals at this time, but it is argued that figures such as Edward II, Richard the Lionheart, Philip II Augustus, and William Rufus were engaged in same-sex relationships.
Also during the medieval period, there were legal arrangements called adelphopoiesis ("brother-making") in the Eastern Mediterranean or affrèrement ("enbrotherment") in France that allowed two men to share living quarters and pool their resources, sharing "one bread, one wine, one purse." Historians such as John Boswell and Allan A. Tulchin have argued that these arrangements amounted to an early form of same-sex marriage. This interpretation of these arrangements remains controversial.
During the Renaissance, wealthy cities in northern Italy—Florence and Venice in particular—were renowned for their widespread practice of same-sex love, engaged in by a considerable part of the male population and constructed along the classical pattern of Greece and Rome. But even as many of the male population were engaging in same-sex relationships, the authorities, under the aegis of the Officers of the Night, were prosecuting, fining, and imprisoning a good portion of that population. Many of the prominent artists who defined the Renaissance such as Michelangelo and Leonardo da Vinci are believed to have had relationships with men. The decline of this period of relative artistic and erotic freedom was precipitated by the rise to power of the moralizing monk Girolamo Savonarola. In England, Geoffery Chaucer's "The Pardoner's Tale" centered around an enigmatic and deceptive character who is also at one point described as "a geldyng or a mare", suggesting that the narrator thought the Pardoner to be either a eunuch ("geldyng") or a homosexual.
The relationships of socially prominent figures, such as King James I and the Duke of Buckingham, served to highlight the issue, including in anonymously authored street pamphlets: "The world is chang'd I know not how, For men Kiss Men, not Women now;...Of J. the First and Buckingham: He, true it is, his Wives Embraces fled, To slabber his lov'd Ganimede" 
The anonymous Love Letters Between a Certain Late Nobleman and the Famous Mr. Wilson was published in 1723 in England and was presumed by some modern scholars to be a novel.
The 1749 edition of John Cleland's popular novel Fanny Hill includes a homosexual scene, but this was removed in its 1750 edition. Also in 1749, the earliest extended and serious defense of homosexuality in English, Ancient and Modern Pederasty Investigated and Exemplified, written by Thomas Cannon, was published, but was suppressed almost immediately. It includes the passage: "Unnatural Desire is a Contradiction in Terms; downright Nonsense. Desire is an amatory Impulse of the inmost human Parts." Around 1785 Jeremy Bentham wrote another defense, but this was not published until 1978. Executions for sodomy continued in the Netherlands until 1803 and in England until 1835.
Between 1864 and 1880 Karl Heinrich Ulrichs published a series of twelve tracts, which he collectively titled Research on the Riddle of Man-Manly Love. In 1867 he became the first self-proclaimed homosexual person to speak out publicly in defense of homosexuality when he pleaded at the Congress of German Jurists in Munich for a resolution urging the repeal of anti-homosexual laws. Sexual Inversion by Havelock Ellis, published in 1896, challenged theories that homosexuality was abnormal, as well as stereotypes, and insisted on the ubiquity of homosexuality and its association with intellectual and artistic achievement. Although medical texts like these (written partly in Latin to obscure the sexual details) were not widely read by the general public, they did lead to the rise of Magnus Hirschfeld's Scientific Humanitarian Committee, which campaigned from 1897 to 1933 against anti-sodomy laws in Germany, as well as a much more informal, unpublicized movement among British intellectuals and writers, led by such figures as Edward Carpenter and John Addington Symonds. Beginning in 1894 with Homogenic Love, Socialist activist and poet Edward Carpenter wrote a string of pro-homosexual articles and pamphlets, and "came out" in 1916 in his book My Days and Dreams. In 1900, Elisar von Kupffer published an anthology of homosexual literature from antiquity to his own time, Lieblingminne und Freundesliebe in der Weltliteratur. His aim was to broaden the public perspective of homosexuality beyond its being viewed simply as a medical or biological issue, but also as an ethical and cultural one. Sigmund Freud, among others, argued that neither predominantly different- nor same-sex sexuality were the norm, instead that what is called "bisexuality" is the normal human condition thwarted by society.
These developments suffered several setbacks, both coincidental and deliberate. For example, in 1895, famed playwright Oscar Wilde was convicted of "gross indecency" in the United Kingdom, and lurid details from the trials (especially those involving young male sex workers) led to increased scrutiny of all facets of relationships between men. The most destructive backlash occurred when the Third Reich specifically targeted LGBT people in the Holocaust. [needs update]
Further information: LGBT in Islam
There are a handful of accounts by Arab travelers to Europe during the mid-1800s. Two of these travelers, Rifa'ah al-Tahtawi and Muhammad sl-Saffar, show their surprise that the French sometimes deliberately mis-translated love poetry about a young boy, instead referring to a young female, to maintain their social norms and morals.
Among modern Middle Eastern countries, same-sex intercourse officially carries the death penalty in several nations, including Saudi Arabia and Iran.
Today, governments in the Middle East often ignore, deny the existence of, or criminalize homosexuality. Iranian President Mahmoud Ahmadinejad, during his 2007 speech at Columbia University, asserted that there were no gay people in Iran. Gay people may live in Iran, however they are forced to keep their sexuality veiled from the society, funded and encouraged by government legislation and traditional norms.
Some ancient religious Assyrian texts contain prayers for divine blessings on homosexual relationships. Freely pictured art of anal intercourse, practiced as part of a religious ritual, dated from the 3rd millennium BC and onwards. Homosexual relationships with royal attendants, between soldiers, and those where a social better was submissive or penetrated were treated as rape or seen as bad omens, and punishments were applied.
The Laws of Manu, the foundational work of Hindu law, mentions a "third sex", members of which may engage in nontraditional gender expression and homosexual activities. The Kama Sutra, written in the 4th century, describes techniques by which homosexuals perform fellatio. Further, such homosexual men were also known to marry, according to the Kama Sutra: "There are also third-sex citizens, sometimes greatly attached to one another and with complete faith in one another, who get married together." (KS 2.9.36).
In many societies of Melanesia, especially in Papua New Guinea, same-sex relationships were an integral part of the culture until the middle of the last century. The Etoro and Marind-anim for example, even viewed heterosexuality as sinful[clarification needed] and celebrated homosexuality instead. In many traditional Melanesian cultures a prepubertal boy would be paired with an older adolescent who would become his mentor and who would "inseminate" him (orally, anally, or topically, depending on the tribe) over a number of years in order for the younger to also reach puberty. Many Melanesian societies, however, have become hostile towards same-sex relationships since the introduction of Christianity by European missionaries.
Further information: LGBT history § Africa, and LGBT rights in Africa § History of male homosexuality in Africa
Homosexuality in ancient Egypt is a passionately disputed subject within Egyptology: historians and egyptologists alike debate what kind of view the Ancient Egyptians society fostered about homosexuality. Only a handful of direct hints have survived to this day and many possible indications are only vague and offer plenty of room for speculation.
The best known case of possible homosexuality in Ancient Egypt is that of the two high officials Nyankh-Khnum and Khnum-hotep. Both men lived and served under pharaoh Niuserre during the 5th Dynasty (c. 2494–2345 BC). Nyankh-Khnum and Khnum-hotep each had families of their own with children and wives, but when they died their families apparently decided to bury them together in one and the same mastaba tomb. In this mastaba, several paintings depict both men embracing each other and touching their faces nose-on-nose. These depictions leave plenty of room for speculation, because in Ancient Egypt the nose-on-nose touching normally represented a kiss.
Egyptologists and historians disagree about how to interpret the paintings of Nyankh-khnum and Khnum-hotep. Some scholars believe that the paintings reflect an example of homosexuality between two married men and prove that the Ancient Egyptians accepted same-sex relationships. Other scholars disagree and interpret the scenes as an evidence that Nyankh-khnum and Khnum-hotep were twins, even possibly conjoined twins. No matter what interpretation is correct, the paintings show at the very least that Nyankh-khnum and Khnum-hotep must have been very close to each other in life as in death.
It remains unclear what exact view the Ancient Egyptians fostered about homosexuality. Any document and literature that actually contains sexually orientated stories never name the nature of the sexual deeds, but instead uses stilted and flowery paraphrases. While the stories about Seth and his sexual behavior may reveal rather negative thoughts and views, the tomb inscription of Nyankh-khnum and Khnum-hotep may instead suggest that homosexuality was likewise accepted. Ancient Egyptian documents never clearly say that same-sex relationships were seen as reprehensible or despicable. And no Ancient Egyptian document mentions that homosexual acts were set under penalty. Thus, a straight evaluation remains problematic.
In the 19th century Mwanga II (1868–1903) the Kabaka of Buganda regularly had sex with his male page.
In Ethiopia Bieber (1909) “encountered Uranism” among the Semitic Harari people and noted that “sodomy is not foreign to the Harari. Albeit not as commonly, it also occurs among the Galla [Oromo] and Somal[i].” He also noted mutual masturbation by both sexes and all ages for all three peoples, and specified that among the Harari, Uranism was practiced as often between men as between men and boys. More recently, Gamst (1969) reported homosexual relations among shepherd boys of the Cushitic-speaking Qemant (Kemant) of central Ethiopia. Among Amhara peasants, Messing (1957) found (better-accepted) male transvestites, who they view as “god’s mistakes.” Wändarwäräd (“literally male-female”) with visible male sexual characteristics, but whose structure is popularly believed to be defective. Among the Maale of southern Ethiopia, “a small minority [of men] crossed over to feminine roles. Called ashtime, these (biological) males dressed like women, performed female tasks, cared for their own houses, and apparently had sexual relations with men,” according to Donald Donham (1990).
Cross-gender homosexuality not tied to possession cults has been reported in a number of East African societies. Needham (1973) described a religious leadership role called mugawe among the Meru of Kenya which includes wearing women's clothes and hairstyle. Mugawe are frequently homosexual, and sometimes are married to a man. Bryk (1964) reported active (i.e., insertive) Kikuyu pederasts called onek. and also mentioned “homoerotic bachelors” among the pastoralist Nandi and Maragoli (Wanga).
After World War II, the history of homosexuality in Western societies progressed on very similar and often intertwined paths.
In 1948, American biologist Alfred Kinsey published Sexual Behavior in the Human Male, popularly known as the Kinsey Reports. In 1957, the UK government commissioned the Wolfenden report to review the country's anti-sodomy laws; the final report advised decriminalizing consensual homosexual conduct, though the laws were not actually changed for another ten years.
Homosexuality was deemed to be a psychiatric disorder for many years, although the studies this theory was based on were later determined to be flawed. In 1973 homosexuality was declassified as a mental illness in the United Kingdom. In 1986 all references to homosexuality as a psychiatric disorder were removed from the Diagnostic and Statistical Manual of Mental Disorders (DSM) of the American Psychiatric Association.
During the Sexual Revolution, the different-sex sexual ideal became completely separated from procreation, yet at the same time was distanced from same-sex sexuality. Many people viewed this freeing of different-sex sexuality as leading to more freedom for same-sex sexuality.
The Stonewall riots were a series of violent conflicts between New York City police officers and the patrons of the Stonewall Inn, a gay hangout in Greenwich Village. The riot began on Friday, June 27, 1969, during a routine police raid, when trans women and men, gay men, lesbians, street queens, and other street people fought back in the spirit of the civil rights movements of the era. This riot ended on the morning of 28 June, but smaller demonstrations occurred in the neighborhood throughout the remainder of the week. In the aftermath of the riots, many gay rights organizations formed such as the Gay Liberation Front (GLF). A year later the first Gay Pride March was held to mark the anniversary of the uprising.
The terms homosexual and heterosexual were coined by Karl-Maria Kertbeny in private correspondence in 1868 and published in two pamphlets in 1869, becoming the standard terms when used by Richard von Krafft-Ebing in his Psychopathia Sexualis (1886). The term bisexuality was invented in the 20th century as sexual identities became defined by the predominant sex to which people are attracted and thus a label was needed for those who are not predominantly attracted to one sex. This points out that the history of sexuality is not solely the history of different-sex sexuality plus the history of same-sex sexuality, but a broader conception viewing of historical events in light of our modern concept or concepts of sexuality taken at its most broad and/or literal definitions.
Historical personalities are often described using modern sexual identity terms such as straight, bisexual, gay or queer. Those who favour the practice say that this can highlight such issues as discriminatory historiography by, for example, putting into relief the extent to which same-sex sexual experiences are excluded from biographies of noted figures, or to which sensibilities resulting from same-sex attraction are excluded from literary and artistic consideration of important works, and so on. As well as that, an opposite situation is possible in the modern society: some LGBT-supportive researchers stick to the homosexual theories, excluding other possibilities.
However, many, especially in the academic world, regard the use of modern labels as problematic, owing to differences in the ways that different societies constructed sexual orientation identities and to the connotations of modern words like queer. For example, in many societies same-sex sex acts were expected, or completely ignored, and no identity was constructed on their basis at all. Other academics acknowledge that, for example, even in the modern day not all men who have sex with men identify with any of the modern related terms, and that terms for other modern constructed or medicalized identities (such as nationality or disability) are routinely used in anachronistic contexts as mere descriptors or for ease of modern understanding; thus they have no qualms doing the same for sexual orientation. Academic works usually specify which words will be used and in which context. Readers are cautioned to avoid making assumptions about the identity of historical figures based on the use of the terms mentioned above.
Main article: Homosexuality in ancient Greece
Greek men had great latitude in their sexual expression, but their wives were severely restricted and could hardly move about the town unsupervised if she was old enough that people would ask whose mother she was, not whose wife she was.
Men could also seek adolescent boys as partners as shown by some of the earliest documents concerning same-sex pederastic relationships, which come from Ancient Greece. Though slave boys could be bought, free boys had to be courted, and ancient materials suggest that the father also had to consent to the relationship. Such relationships did not replace marriage between man and woman, but occurred before and during the marriage. A mature man would not usually have a mature male mate (though there were exceptions, among whom Alexander the Great); he would be the erastes (lover) to a young eromenos (loved one). Dover suggests that it was considered improper for the eromenos to feel desire, as that would not be masculine. Driven by desire and admiration, the erastes would devote himself unselfishly by providing all the education his eromenos required to thrive in society. In recent times, Dover's theory suggests that questioned in light of massive evidence of ancient art and love poetry, a more emotional connection than earlier researchers liked to acknowledge. Some research has shown that ancient Greeks believed semen to be the source of knowledge and that these relationships served to pass wisdom on from the erastes to the eromenos.
The "conquest mentality" of the ancient Romans shaped Roman homosexual practices. In the Roman Republic, a citizen's political liberty was defined in part by the right to preserve his body from physical compulsion or use by others; for the male citizen to submit his body to the giving of pleasure was considered servile. As long as a man played the penetrative role, it was socially acceptable and considered natural for him to have same-sex relations, without a perceived loss of his masculinity or social standing. Sex between male citizens of equal status, including soldiers, was disparaged, and in some circumstances penalized harshly. The bodies of citizen youths were strictly off-limits, and the Lex Scantinia imposed penalties on those who committed a sex crime (stuprum) against a freeborn male minor. Male slaves, prostitutes, and entertainers or others considered infames (of no social standing) were acceptable sex partners for the dominant male citizen to penetrate.
"Homosexual" and "heterosexual" were thus not categories of Roman sexuality, and no words exist in Latin that would precisely translate these concepts. A male citizen who willingly performed oral sex or received anal sex was disparaged. In courtroom and political rhetoric, charges of effeminacy and passive sexual behaviors were directed particularly at "democratic" politicians (populares) such as Julius Caesar and Mark Antony. Until the Roman Empire came under Christian rule, there is only limited evidence of legal penalties against men who were presumably "homosexual" in the modern sense.