Think Liza Minnelli and Joel Gray in Carberet. Think West Hollywood, Greenwich Village and Provincetown and the Castro, known as hotbeds of homosexuality.

But they are nothing like the uninhibited urban gay sexual scene and vast homosexual subculture that flourished in Berliin under Germany's Weimar Republic.

Sexual experimentation between the same sexes and medical advances of helping genders ‘trapped within the wrong body’ in Germany more than one hundred years ago shaped our understanding of gay identity today.

The city's liberal years - before the rise of Hitler - are detailed in a new book, Gay Berlin.

The science of ‘transsexuality’ was founded in Berlin at the Institute of Sexual Science where the first male-to-female surgery was performed. The words ‘homosexual’ or ‘transvestite’ were German innovations.

Police mugshots of Berlin prostitute Johann Scheff, arrested in July 1932. Youths dressed in women's clothing who successfully passed for women, descended on department stores en masse stealing large quantities of merchandise.

The cover of Die Intel, December 1930, advertising a serialized installment of Men for Sale (Manner zu verkaufen). German gay magazines also offered gay and lesbian friendly services to the gay subculture including medical doctors specializing in 'sexual disturbances', detective agencies offering to investigate blackmail threats, as well as dressmakers and restaurants

Liza Minnelli and Joel Grey starred in the film version of Carbaret in 1972

Male prostitution, homosexual bars and nightclubs, cabarets populated by gay men, lesbians and transsexuals flourished in a wild, incomparable sexual subculture that was exciting yet dangerous.

It was in Berlin where scientists concluded that ‘same sex love was a natural, inborn characteristic and not merely the perversion of a ‘normal’ sexual tendency’, author and scholar Robert Beachy writes in his compelling book, Gay Berlin: Birthplace of a Modern Identity by Knopf Publishers.

The Weimar Republic emerged out of the wreckage of Germany's war. The Kaiser was gone, the 1919 Versailles Treaty saw the abolition of the German Empire and the loss of significant amounts of its territory.

It was a troubled and tortured time for Germany, but Berlin, the old imperial capital became its most liberal city.

High living, a vibrant urban life and relaxed social attitudes, along with the influx of American money defined the Golden Twenties in Berlin that was the most creative period in German history.

Writers, poets, artists from London, France, the United States arrived in the German city to witness and experience the wild erotic sexual freedom along with curiosity seekers, voyeurs, and homosexuals.

Western Europeans, Scandinavians and Russians all came to indulge their sexual appetites in the hedonistic nightlife and party culture of the German capital – or they came to witness the ‘luridly licentious Berlin’, spiking their own voyeuristic impulses.

‘The pervasive prostitution (both male and female), the public cross-dressing, and the easy access to bars and clubs that catered to homosexual men and lesbians were just a few of the features that supported Berlin’s sex industry’.

Transvestite prostitutes sitting on the laps of gay men in the popular Berlin gay bar Marienkasin

Hansi Sturm, was the winner of the Miss Eldorado transvestite pageant in 1926

There were twenty-five to thirty separate homosexual German-language periodicals that were appearing in Berlin, weekly or monthly.

There were no other journals published anywhere else in the world until after 1945.

Openly nudist and homosexual titles were displayed in the kiosks.

Same-sex bars, clubs and cafes advertised as well as the professional services of doctors, dentists, lawyers, stationers…all with the implied ‘friends patronize friends’.

In those magazines, anyone facing blackmail found private detectives to track down extortion threats.

Cross-dressers found dressmakers who tailored for large sizes.

There were the single ads placed by individuals forever in search of love.

The American modernist artist, poet and essayist Marsden Hartley, a habitué of 1920s Berlin, ‘attended large transvestite balls and patronized homosexual bars frequented by male hustlers.

He later recalled, ‘Life in Berlin then was at the height of heights – that is to the highest pitch of sophistication and abandon. None of us had seen anything quite like the spectacle’.

Acclaimed American Architect Philip Johnson often considered the dean of American architects, ‘availed himself of Berlin’s male prostitution’.

‘Paris was never that hospitable’, Johnson said. He became fluent in German later saying, ‘I learned it the best way, using "the horizontal method".'

Transvestites having drinks in the Eldorado club that was not hidden away but celebrated in the golden age of the gay bar and club scene in Weimar Berlin. It was a hot spot for high society and partying until dawn was the norm

Dr Magnus Hirschfeld opened the Institute for Sexual Science in March 1919, the first such facility in the world to offer medical and psychological counseling on sexual issues to heterosexual men and women, homosexuals, cross-dressers and intersex individuals also known as hermaphrodites or individuals caught between male and female.

‘The institute represented the first attempt to establish "sexology", or sexual science, as a topic of legitimate academic study and research.

‘Nowhere else in the world was there so much as a university department or chair devoted to the subject, much less an entire institute,' writes author Robert Beachy.

The Institute also emphasized public education and had a museum of sexuality, the Hirschfeld Museum, with not only wall charts and photographs but also cases filled with phalluses and fetishes from around the globe.

Photographs of homosexuals dressed in huge hats, earrings and makeup adored the walls as well as women in men’s clothing and top hats.

When Dr William Robinson, a New York physician and prominent activist for birth control, visited the institute in 1925, he stated: ‘It is an institution absolutely unique in the whole world…which I hoped to establish in the United States but which I felt would not thrive on account of our prudish, hypocritical attitude to all questions of sex.’

It was at this institute that Hirschfeld and his colleagues pioneered some of the first sex-reassignment surgeries as well as primitive hormone treatments

Dr Hirschfeld studied cross-dressing, men and women who wore the clothing of the opposite sex.

Previously interpreted as a symptom of homosexuality by psychiatrists and sexologists, and associated with prostitution and criminal activity, Hirschfeld believed cross-dressers were often heterosexual.

Picture postcard of the gay club Silhouette, popular in the late 1920s and early 1930s. Always under a blue haze of cigarette and cigar smoke, film stars, cabaret artists and wealthy nobility were regulars including a young Marlene Dietrich alongside princes, counts and barons.

Nazi officials sort through 'un-German' and 'perverted' materials in the debris of the Institute for Social Science, that was ransacked on May 6, 1933, for a book burning event they staged four days later.

Male and female impersonators drew huge crowds at cabarets, circuses and variety theatres – as well as providing entertainment at the big transvestite balls and homosexual clubs, but they faced the possibility of being arrested by the police and harassed.

Dr Hirschfeld helped reform the practices of the Berlin police and convinced them to issue ‘transvestite passes’ so that performers could work without fear of harassment although there was no law prohibiting public cross-dressing.

But dressing like the opposite sex sometimes inspired the desire for a physical metamorphosis.

So the doctor performed one of the first (primitive) male-to-female sex-reassignment surgeries on a twenty-three year old officer who had fought in World War I.

From childhood on, he felt he was trapped in the wrong body and only went into the military to demonstrate his masculinity. But that didn’t subdue his feminine feelings and when the war was over, he felt suicidal.

Hirschfeld’s colleague, Dr. Arthur Kronfeld removed the man’s testicles and the effect was quite successful leading to a ‘psychic relaxation and a permanent feeling of harmony and balance’.

His facial hair disappeared and now he passed for a woman.

He visited a Dresden gynecologist, Dr. Richard Muhsam, who made a ‘vagina-like structure’ and tucked his member up in there in what was the first attempt to construct a vagina for a man.

Five months later, the former officer was back and reported having erections.

He also had fallen in love with a woman, abandoned his cross-dressing and was now masculine.

The doctor successfully undid the surgery and restored his masculinity.

Afternoon teas and large costume balls were held at the Institute as another venue for flamboyant cross-dressers. The balls attracted young male prostitutes along with the cross-dressers and prominent, open homosexuals.

Hirschfeld wanted homosexual men and lesbians to experience greater erotic fulfillment that wasn’t connected to procreation.

With the Great Depression of 1929, and the crash of the American stock market, the Golden Age was slipping away to a Hitler-led government by spring 1930, the Nazis were on the rise with the new Reichstag election.

In 1933 Adolf Hitler completed his march to power - and with fury the Nazis pursued Hirschfeld as a symbol of all they hated – as Jew, homosexual and sexologist.