The word "gay" is related to goddess Gaea, an early Achaean earth goddess. In the Roman Empire, her cult was in resurgence where she had been combined with other primal earth goddesses into Magna Mater, the Great Mother. In the earlier cult of one of these earth mothers, Cybele, male devotees would castrate themselves and don women's clothing to become more identified with the goddess; this practice was continued symbolically in Roman times with male priests of Magna Mater dressing as women and being required to abstain from sexual relations with any female. There is evidence that many men who prefered not to have sexual relations with women became priests of Magna Mater (just as many became priests in the cult of Jupiter; see my post on the etymology of "fag" at
http://www.democraticunderground.com/discuss/duboard.php?az=show_topic&forum=102&topic_id=2157556#2157881)
As Christianity became dominant in the Roman Empire, many of the pagan religious groups were forced underground. This was especially true for cults with large members of "alternate lifestyle" members who would not have been accepted into Christianity anyway. It seems that the cult of Magna Mater continued through acting. One of the most noteable aspects of theater is that, until about the 15th century, women were forbidden to be actors. From ancient Greece onward, there existed a class of male actor who specialized in playing women on stage, and it appears that many priests of Magna Mater found refuge in that group.
In the 8th and 9th centuries, there is evidence of "ge" or "gae" being used to refer to vagabond performers. By the late 11th century, the word was being used in France in reference to troubadours. In the 13th century, "gae" began to fuse with "gai", derived from the Latin word
gaius, which means "happy" or "joyous." Interestingly, the Latin word derives from the same Indo-European root as Gaea, whose festivals were some of the most exuberant of the ancient Greek world. During the Renaissance, "gai" was used for popular entertainment that had a comedic, anti-authoritarian mood, for bright, bizaare costumes worn by performers, and for the class of male actors who specialized in women's roles.
During the 16th and 17th centuries, when the Protestant Reformation was at it's height and pleasure of any kind was seen as an offense to public decency, "gai" took on added meaning as "immoral" or "morally corrupt." Theater was supressed by social pressure and even law; in France for a time, the word "actrice" was synonymous with "whore." The expression "gai Paris" was originally used in the French provinces to describe the (perceived) sinfulness of the capital; the phrase was taken up by writers and painters and turned around to describe the joys of city life as compared to the drudgery of the farm.
By the late 18th century in Europe, the meaning of "gai" and the English equivalent, "gay", had extended beyond its traditional theater meaning to reference any "morally corrupt" man, regardless of sexuality. Alcoholics, overeaters, patrons of brothels -- anyone who induldged in an extravagently luxurious lifestyle -- was "gay." That usage was short lived, and in the early 18th century the word again took up the meaning of happy and joyous in common useage. Its negative connotations became narrowed to refer to male sexual sins, as men were supposed to dress "respectably" and be "sober" in their worldview. By the mid 19th century, most of these negative meanings had fallen in to disuse.
"Gay" cotinued to mean a man who had sex with men, and was preserved in the first "Ge" community of the theater. Clark Gable's line in the 1939 movie, "Bringing Up Baby", where he explained his wearing of a frilly women's bathrobe as "I've gone gay, all of a sudden!", was a joke than any actor would have gotten, but probably went right over the head of the audience. The word was revived for common use and reclaimed by the early gay rights movement.