“We that are young,” says the Duke of Albany at the end of King Lear, “shall never see so much, nor live so long.” But sometimes this sense that history is what happened to our predecessors disappears, and we are aware that we are in the living current of history, that vast developments are taking place, utterly changing our very sense of who we are. Such has been the transformation in attitudes to homosexuality in my lifetime.

I was born in 1949, theoretically in the Dark Ages of homosexual experience. But under the threat of imminent extinction, and with many husbands absent for long periods of time during the Second World War, the strict compartmentalisation of sexual desires had broken down. People followed their impulses: who knew whether they’d be alive tomorrow? Peace brought an anxious reassertion of supposedly core values but, at subconscious levels, attitudes had fundamentally changed. Gay men and women who had popped their heads over the parapet ducked down again out of sight, but they were just biding their time.

The authorities began to feel embattled. By the 1950s, particularly during the tenure of the fiercely anti-gay Tory home secretary David Maxwell Fyfe, prosecutions for “unnatural vice” rose drastically. Maxwell Fyfe had been one of the leading prosecutors at the Nuremberg trials, and he now turned his ruthless forensic intellect on to a new enemy, which he treated equally pitilessly. Promising to “rid England of this plague”, he successfully engendered a climate of fear, wittily dubbed the “Lavender Scare”.

But there was nothing amusing about the reality for many men – for Sir John Gielgud, for example, in 1953, when he was arrested for importuning in a public lavatory. Although he escaped prison, his trial was widely reported, and he assumed (wrongly, as it happens) that his career was over. Much worse befell Bletchley code-breaker Alan Turing, who avoided imprisonment only by agreeing to undergo a course of chemical castration; he killed himself at the age of 41. And so it went on, a medieval witch-hunt of increasing stridency, visited not just on the rich and famous but also on ordinary men up and down the land.

However Maxwell Fyfe overplayed his hand in the notorious case of Lord Montagu of Beaulieu, who, along with his friends the journalist Peter Wildeblood and the landowner Michael Pitt-Rivers, was imprisoned in 1954 for a mild dalliance with some airmen. The three accused were prosecuted under the provisions of the 1885 Criminal Law Amendment Act, the same law under which Oscar Wilde had been prosecuted and imprisoned 60 years earlier. It was to a large extent the Wilde case that had engendered the attitudes to homosexuality that prevailed throughout most of the first half of the 20th century. By contrast, the Montagu case provoked a public outcry against the vengeful brutality of the law.

There was a rash of scandals in which the men all ended up in prison or dead

Needless to say, as a five-year-old boy, the whole lurid business passed me by. All I knew then was how susceptible I was to masculine charms. In time these feelings merged with formless, nameless longings directed towards boys of my own age. My feelings made me anxious. At a deep level I was fearful, not so much of adult censure, as of possible rejection by the objects of my desire. Somehow, at some subliminal level, I had been given to understand that what I felt was not really appropriate. At the age of nine, I was whisked off to Africa, to Northern Rhodesia, with my mother, where another layer of complication emerged: I found myself attracted to the young black servants. Now that was definitely not appropriate – I didn’t need anybody in that tight little colonial society to tell me that.

This was 1958. I didn’t return to England until 1961, having spent the intervening years in a permanent and perpetual state of bafflement and anxiety. And longing. By the time I came home, I had discovered the existence of something called “homosexuality”, which seemed, by and large, to describe my situation. Reunited with my rather racy family, my ears pricked up at any mention of “queers”, “homos” or “nancy boys”. Whatever the nomenclature, I knew I was one, and the outlook wasn’t promising. Not that my family was unduly censorious – it was just that “homo-queers” were clearly not as others. Mostly the suggestion was that they belonged to some kind of intermediate sex, which caused me to examine my pink, puffy pre-adolescent body with deep anxiety. I didn’t feel feminine in any way, but how could you tell?

Then there was the whole curious phenomenon of “camp”. It was everywhere in the early 1960s: on television, on radio – limp wrists, mincing walks, lip-smacking sibilants, pursed lips. Why, I wondered, did homo-queers behave like that, in some mad parody of women? What had my strong, manly desires to do with Danny La Rue?

In the bigger world beyond my personal bewilderments, there was a rash of homosexual scandals in which the participants invariably ended up in prison or dead. It was all getting rather depressing. A perusal of DJ West’s widely available Pelican paperback Homosexuality (1960) yielded the discouraging information that my feelings were a result of my upbringing, and that I could expect a wretched life on the margins of society, in perpetual denial of my true self, except perhaps, furtively, among my fellow degenerates.

Roman holiday: Oscar Wilde on holiday in Italy. Photograph: National Portrait Gallery London

There was a crumb of hope: from West’s pages I learned that in prisoner-of-war camps during the Second World War, men had formed intense sexual bonds, but this was brushed away when West firmly noted that those bonds had immediately dissolved when the men returned to their wives.

It was desperately hard to find any models in the world around me for the sort of sexual-emotional life I had in mind. There were fine novels in which the love that dared not speak its name found its tongue, so to speak, and then there Plato’s Symposium, where there is much banter about boy-love. The problem was, I was living in Streatham, not Sparta, and I lived in terror of what might happen if I were to make advances to a straight man – terrified, especially, of the danger of being exposed as a “homo”. I hated that word. But what was I? Who was I to be? A lover of men, I decided, was a description I could accept.

Meanwhile, I noted one phenomenon with deep interest. The composer Benjamin Britten and his lover Peter Pears were universally known to be a couple; they had been received together, I saw, by the Queen when she opened the Snape Maltings concert hall. It was OK to be queer, it seemed, if you were a respectable couple, married in all but name. What society feared was the unattached predatory male sexual animal. From that moment forth, I started to dream of a partner with whom I would work and live: a passionate companion in life.

My present reality was very far from that. I had, without much fuss, come out as gay to my fellow students at school. To do so in 1964, at a Catholic grammar school – quite a rough one, despite being in Chelsea – was, in retrospect, bold, but the admission provoked more curiosity than scorn. To the perpetual adolescent question, “Who turns you on?” my mates would say, “Diana Dors” or “Ursula Andress”, and I’d say, “Cliff Richard” (reader, he did). “You queer, then?” they’d ask, and I’d say, “Yes”, and that was that.

You want it, Mister? Hashish. Heroin. My sister. My mother. My brother. Me?

The problem for me was that I seemed to be the only gay in the playground. I used to long to have been to public school, not for the social advantages, but for the sex, which I understood to be rife. As my hormones kicked in, the situation became desperate. Once or twice, on late-night trains or on park benches, I was approached and even fondled by plump and coldly sweating mackintoshed men who horrified me, both in themselves and also because they had somehow realised I harboured desires for my own sex. How had they known? And was I going to turn out like them?

I went back to books for enlightenment. I picked up a copy of Frank Harris’s Oscar Wilde (1916), around which the enterprising bookseller had placed a wrapper that said: “Oscar Wilde: he turned men into women.” Wilde became my hero, although even I could see that, with his self-induced martyrdom, he was a complicated role model.

André Gide was more encouraging – at least he never went to prison. Cocteau got away with it, too, by dint of a brilliant and distracting display of eloquence and provocation. To be acceptable, then, you had either to be funny – my family was endlessly going on about how “amusing” Noël Coward (though a queer) was – or a genius. I knew how to raise a laugh when I was in good form, but scarcely enough to stop me being arrested, and I could lay no claims to genius.

One book alone out of all the dozens that I devoured seemed to offer some sort of sanity. Published in 1966, it was by a Labour MP, Bryan Magee, and the title alone – One in Twenty – was cheering. Coolly and without tub-thumping, Magee observed that it was ridiculous and pointless to condemn, much less to imprison, men who desired other men. Meanwhile, cabinet ministers were being arrested in royal parks in flagrante with guardsmen.

It was now 1967. Things were on the move. The recommendations of the government committee set up in the wake of the Montagu case were finally – after 10 years of bitter opposition – being implemented, and the 1967 Sexual Offences Act, popularly known as the “buggers’ charter”, passed into law. “Homosexual behaviour between consenting adults in private” would no longer be a criminal offence; parliament finally repealed the notorious Criminal Law Amendment Act, 1885. It was scarcely blanket legalisation, but for the first time in 80 years, men over the age of 21 could have sex with one another in private. This still left quite a lot of us disenfranchised: had I had sex at the age of 18, I or my partner could still have been locked up.

As it happens, my virginity remained frustratingly intact. But things were on the move for me. I’d left school and had written an enthusiastic letter to Laurence Olivier, who replied suggesting I come and work at the Old Vic, in the box office. It was there, finally, that my real life began. I began to see how I might fit into the scheme of things. I made the surprising discovery that both actors and gay people – this was the first time I’d heard the word in this context – were just like everyone else: some were brilliant and witty and sexy and flamboyant, some were surly and antisocial, others were solid and a little dull. They were, in fact, as diverse as the rest of the population, with the significant difference that they were (for the most part) open about themselves.

Young idol: Callow always had a crush on Cliff Richard. Photograph: Derek Allan/National Portrait Gallery London

Things were getting better, but I was still not entirely clear in my mind. Confusion rose to new heights when, in the summer of 1968, before I went to university, I went on holiday to Tangier with my two best friends from school. As we got off the ferry from Gibraltar, a little boy came up to me and said: “You want it, Mister?” ‘Want what?’ I said, anxiously. “Hashish,” he replied. “Heroin. My sister. My mother. My brother. Me?”

Tangier was then in its last gasp as a hotbed of sex and drugs, a well-known destination for English queers – not gays, queers. Hair swept back and tinted, they would totter perilously along the streets in hotpants and high heels, adjusting their make-up every few steps, without provoking the slightest censure from the devout Muslims all around. Boys were readily available for a few dirhams and, at the famous El Piano bar, Syd and Dennis presided over an establishment in which every single person who appeared to be a woman was a man.

I wandered through this sexual Disneyland in a state of mingled bewilderment and arousal. I fell in love with a couple of young Arab men, attempting to seduce them with my over-literary French, but in truth I had no aptitude for seduction. I was looking for someone to take me in hand.

I came back from Morocco none the wiser, with a nasty case of dysentery, and then immediately headed off for university – Queen’s University Belfast, ironically named, I thought, because if there were any queens there, they were in deep hiding.

After Tangier, arriving in Belfast in 1968 felt like stepping out of a time machine. Severely Protestant, Northern Ireland was not actually covered by the new legislation, nor would it be until 1982. Was I deliberately trying never to have sex? It was as much to take advantage of the new sexual dispensation back on the mainland as to discover whether I had any talent as an actor that I quit Queen’s after a year and went to drama school.

The varieties of gay desire were astounding. We celebrated them all

And then it all happened: in the enchanted, safe space of drama school, I lost my hated virginity and plunged into the sexual life I had begun to doubt would ever exist for me. In the fullness of time, I shacked up with a fellow student, my first long-term relationship, which gave me an idea of what life lived with another man might be like.

It was 1973, and the love that had for so long not dared to speak its name was now in full cry. The framers of the 1967 act had piously hoped that homosexuals, though now legal, would not flaunt their new-found freedom, but remain discreet and circumspect. Would we hell: we marched and we chanted, not so much to demand further changes to the law – though we did that, too – but simply to assert that we were here and we were queer and we were not going away.

Under the rainbow banner of Gay Liberation, homosexuality proclaimed itself a house of many mansions: the varieties of gay desire were astounding. But we celebrated them all. “Sing if you’re glad to be gay,” enjoined Tom Robinson, “Sing if you’re happy that way.” I remember (a little imprecisely) a delirium of dancing and drinking and unbridled canoodling. Bliss was it in that dawn to be alive, but to be gay was very heaven. Discos like Bang and the Embassy club in London were heaving masses of newly unleashed libidos; everyone seemed ripe for the plucking.

At first there was a heady innocence about it, a 60s sweetness, but then a harder edge crept in. Gratification seemed not a happy, serendipitous thing, but a goal to be pursued unrelentingly. Sex was no longer a diversion: it had become a duty. A day without a fuck was a wasted day. Thus licentiousness began to overtake liberation.

Whatever the pluses or minuses of that, it meant that the pink pound suddenly became a significant economic lever, so powerful that the capitalists who would normally have been outraged by a gay presence in their venues succumbed as soon as they understood that gay nights were outselling all others threefold.

Kiss the groom: Simon Callow and his husband Sebastian Fox on their wedding day, Mykonos, June 2016. Photograph: Sim Canetty/Simon Callow Collection

The great bacchanal went on apace, riotously and raucously, from capital to capital across the western world: it was Babylon-on-Thames, Babylon-on-Hudson, Babylon-sur-Seine, Babylon-am-Spree. And then, in the early 80s, fragments of dark and disturbing news started flitting across the Atlantic. With terrifying rapidity, illness and death brought the party to an abrupt end, as reveller after reveller succumbed to what at first we thought was a gay cancer, but which soon, it became clear, was nothing less than a gay plague.

Aids transformed the lives and attitudes of gay men everywhere. It was the terrible and sombre growing-up after a hectic adolescence. Governments were reluctant to engage with the problem, so gay men took matters into their own hands. Those of us who were spared, engulfed with a guilt not unlike that of Holocaust survivors, started to organise the treatment and care of this hideous medieval affliction, in which young, healthy men became skeletons overnight. People who had remained discreet about their homosexuality emerged from their closets: what was happening dwarfed anyone’s anxieties about their careers or the sensibilities of their families.

I had officially come out in 1984; I had to write a book in order to do so, because whenever I had tried to come clean in interviews it was not reported. The journalists were, they thought, protecting me, but they also knew that my declaring myself gay wasn’t a story; them finding me out would have been. More and more prominent figures started coming out, until finally the promised land was in sight: a world in which it didn’t matter whether you were gay or not.

It had always been my belief that despite the existence of small and virulent enclaves of fundamentalist homophobia, the British people in general rather like their gays. The short, unhappy life of Section 28 of the Local Government Act 1988 – in which local authorities were prohibited from “promoting” homosexuality – ended ignominiously some 15 years after it was enacted with no prosecution having taken place. Again, prominent gay men and women had been quick to denounce it, and the general public became used to the idea of gay politicians, gay lawyers, gay priests. Before long, with very little fuss, the age of consent was, in instalments, reduced to bring parity with heterosexuals.

Meanwhile, something new had started: an utterly unpredictable development, as if in defiance of that heartless phrase in Section 28, “pretended family relationships”. The idea of marriage, abhorrent to religious conservatives, at first divided gay opinion, too. It seemed to some that homosexuality was an essentially radical phenomenon that should always exist at an angle to the rest of society. But more and more gay men and women wanted the particular blessing of a formal consecration of their commitment to each other.

This had oddly been presaged in Richard Curtis’s wildly successful film Four Weddings and a Funeral (1994), in which I had the privilege of being the funeral. Of long-term partners Gareth and Matthew’s relationship, Hugh Grant’s character says to another in their group of friends: “All these years we’ve been single and proud of it, and never noticed that two of us were, in effect, married all this time.”

In 2004, the Labour government of Tony Blair introduced a bill creating the new category of civil partnership, which included virtually all the legal privileges of marriage. It was a powerful symbol, but the even more powerful one of marriage began to seem logical.

And so, somewhat improbably, as profound a transformation of the position of gay people within the life of the nation as any that has occurred in British history came about under a coalition administration led by a Conservative prime minister, David Cameron, despite fierce opposition from a highly vocal minority within parliament and in the country itself.

I had my doubts for many years. It was not exactly that I thought, as some of my friends did, that gay marriage was a mere aping of bourgeois norms. It was rather that in my family, marriage – my parents’, for one – had not been very successful. But slowly I began to understand that it was – or could be – a very public symbol of a profound and challenging commitment to a life shared at the deepest level.

And as these thoughts formed in my mind, I met the first man with whom I had ever wished to embark on that heroic undertaking. Reader, I married him. And, to my surprise, marriage, a boon in itself, has fundamentally changed my feelings about myself as a member of society; I now feel quite differently connected to it. What was merely private has become an integral and manifest part of the body politic; my love for my husband makes a contribution to the commonweal.

This is how far we have come.