As the disappointing Gay Icons exhibition at the National Gallery reaches the end of its run, I’ve been thinking about a sub-genre of the ‘icon’ phenomenon – the gay diva.

While a gay icon can be anyone who has inspired or been supportive of gay people – or even be themselves a heroic gay person – the diva is an entertainer who has brought a message of hope and comfort to gay people in times of trouble or oppression. Or who simply satisfies the craving for camp and over-the-top personalities.

It’s a fascinating topic because the nature of the diva, and her relationship to her gay audience, has changed dramatically since the 1930s, when mass entertainment really took off.

In those days, of course, right through to the late 1970s, homosexuality was ruthlessly suppressed and so all expressions of a gay sensibility had to be oblique or clandestine.

Nowadays, of course, gay liberation has released us to express our feelings openly and relatively safely and develop our culture freely. The modern diva need not depend on secret, or even subconscious, communication with her gay audience. She can speak to them directly on their own terms.

We have gone from the times of silver screen goddesses like Bette Davis and Joan Crawford, who became ciphers for the closeted community of their day, to the present, where modern gay favourites like Kylie Minogue and Madonna actually perform in gay venues, acknowledging and treasuring their most loyal fans. And there are divas who are themselves openly gay – like kd lang.

Of course, the devotion of sections of the gay community to certain histrionic actresses and overwrought singers has been seen by many unsympathetic straight people as a means of insult. The quick way for a comedian to get a laugh at the expense of a gay man would be to introduce him as “The decretary of the Lana Turner fan club”. Indeed, when Barbra Streisand recently appeared on the Jonathan Ross show he asked how on earth he could be such a big fan of hers and not be gay.

But I think we shouldn’t underestimate the part that these entertainers played in the development of the gay community. It is now part of gay folklore that the Stonewall riots started on the day that Judy Garland died.

In the days before it was possible to create support groups for gay people, we would rally around the flag of our favourite star. I recently saw some old newsreel film from the 1960s of Marlene Dietrich emerging from the stage door of a New York theatre after one of her shows. She was greeted by hundreds of young men – quite obviously non-heterosexuals – whose enthusiasm eventually forced her on to the roof of her car, from where she threw signed photos.

Then, last week, I saw some footage of Madonna on her Sticky & Sweet tour at a huge stadium in Argentina. At the very front of the crowd, arms outstretched, hopelessly reaching for their idol, were young men, and some young women, who obviously – several generations later – had come from the same mould as the Marlene groupies.

The difference between these two events was that Marlene’s admirers were probably still deep in the closet. Remember, it was five years before Stonewall and the Dietrich and Garland concerts were some of the few places gay men could be sure they would be in sympathetic company and enjoy something that was special to their own sensibility. They could sigh in sympathy as Judy crooned moodily about the Man Who Got Away or see Marlene dressed up in top hat and tails singing with deep feeling, love songs to women. When she sang ‘I’ve Grown Accustomed to her Face’, the lesbians in the audience knew they were in the presence of a fellow traveller.

With Madonna, the youngsters in the crowd were probably all out and proud but still expressing the same gay preference in entertainment. The subversive nature of a lot of the women who gay men and lesbians take to their hearts should not be underestimated, either. People like Bette Davis and Joan Crawford were undermining the accepted gender roles of their time by being far more powerful than the male co-stars of their films. They portrayed characters that dominated and were self-sufficient in their own lives – something that women weren’t supposed be in those days. Many lesbians and gay men took comfort from this flouting of society’s rigid rules, and related it to their own lack of conformity.

People like Mae West – as well as being side-splittingly camp – completely undermined sex roles and, indeed, sex itself. Her unconstrained comic sexuality, uninhibited by the demands of the tight-lipped culture that surrounded her, was a great comfort to many of her gay fans of that period. Here was someone who was laughing at the morality police and the conformists, the very people who kept gay men and women locked in the closet. Mae didn’t give a damn, and she was the unofficial ambassador for the sexual outcasts of the time.

It was even suggested by one film buff that Mae West would eventually be revealed to have been a man in drag all along.

I have been searching the archives for more gay divas of yesteryear and have come up with some corkers. Gracie Fields, for instance, apparently had a major gay following in the 1930s and when you look at her early films you can see why. She is the typical open hearted lass who every gay youngster would love to have as his best friend and confidante. This is, of course, in the days before she became the leading light on Songs of Praise.

Then there are the torch singers – those women who were prepared to go on stage, rip open their chest and show us their broken heart. Think Piaf, Garland, Bassey and Minelli. And what did these four have in common? They all had gay husbands, of course!

There are many others who have the necessary ingredients to achieve divadom – Bette Midler, Maria Callas, Yma Sumac and no doubt going back all the way to Cleopatra and Helen of Troy.

I am presenting the fruits of my research in a funny and affectionate new show I’ve called A Brief History of Divas. You can see it Thursday 5th and Friday 6th November at Conway Hall, 25 Red Lion Square, London WC1R 4RL at 7.30 (nearest tube: Holborn). Admission is £10 and you can find all the details here: www.secularism.org.uk/divas .

Terry Sanderson is the president of the National Secular Society.