The Wildeblood case was less sensational than the Wilde case, but it has had as much of an afterlife. Peter Wildeblood’s ordeal – he was tried and convicted in 1954, along with Lord Montagu of Beaulieu and Michael Pitt-Rivers – is as far in the past now as Wilde’s imprisonment in 1895 was then. It is the contrast in their actions after prison that marks the difference between Wilde’s and Wildeblood’s experiences of disgrace.

While he was serving his sentence Wildeblood resented the well-meaning assumption, made by warders and others, that he would disappear when he was released, most likely living abroad as Wilde had done. Instead, he intended to take up his interrupted life – and he did, though with a new reformist agenda. He had been a journalist, but hardly a campaigning one (he was the diplomatic correspondent of the Daily Mail at the time of his arrest). He had found a subject, and his memoir, Against the Law, was published in 1955, the year of his release. The title of the book has a subtle double meaning, perhaps muffled on first publication by the prominence of the word “victim” on the cover – those were the days when the marketing of a hardback could be more lurid than the paperback that followed it. The title plays with the overtones of the word “against”: before Wildeblood was sent to prison his activities merely contravened the law; afterwards they opposed it.

In a British sex scandal it is no surprise that class should be a factor, but it plays out in the Wildeblood case in a variety of ways. The obvious point is that toffs were targeted for prosecution, Lord Montagu above all, in a way that was hardly disguised. It was all very selective: two young airmen, Edward McNally and John Reynolds, received immunity in return for their incriminating testimony and named more than 20 other sexual partners, against whom no action was taken. (There was never any suggestion that either McNally or Reynolds had been seduced by any of the men – they were willing participants.) The intention may have been to underline that social privilege offered no protection, or to reinforce the myth that homosexuality is inherently an aristocratic perversion or pastime.

Behind bars … Daniel Mays as Wildeblood in Against the Law, the BBC’s adaptation of the campaigner’s memoir. Photograph: Dean Rogers/BBC

Wildeblood in his book proposes that the prosecution of prominent homosexuals was part of an agenda, strongly urged by the United States, to weed such people out from important government jobs. In America, McCarthy’s red scare had been accompanied by a “lavender” one, with mass firings of gay employees from the state department. Lurking somewhere in the background are the figures of the spies Burgess and Maclean, whose betrayals made social privilege, homosexuality and treason seem a mutually reinforcing trinity. It was put to Wildeblood during his trial that it was a “feature” of gay men to seek “love associates” in different walks of life from their own, and that McNally was infinitely his social inferior. He replied that it had never been flung in his face that he was consorting with his social inferiors during the war (he served in the RAF). As the book describes, the war years had given him a welcome taste of social inclusion after an education he experienced as alienating – his fellow-servicemen, seeing he was hopeless at it, covered for his deficiencies in drill. He claimed the right to choose his friends.

Wildeblood acknowledges the importance of his legal team, making the comment about Arthur Prothero: “There is some truth in the saying that a man’s best friend is his solicitor.” Prothero lent him a pair of long johns so that he wouldn’t shiver in the cold courtroom and thereby seem frightened. The anti-authoritarian solicitor has never been a common type, and in the 1950s Prothero was possibly unique. He was a friend of my family’s – though it was his younger brother Stanley, who died on 6 June this year, a day after his 101st birthday, I knew personally – and the background they shared may be relevant. Their father was one of the “big five” detectives at Scotland Yard, but Arthur seems to have enjoyed making mischief. As a young man he enjoyed visiting dodgy nightclubs and making sure the management knew whose son he was, confident that they would sit him near the front door and keep the food and drink coming indefinitely as a sort of insurance policy. In the event of a raid his presence would make the police think twice about making any fuss.

Prothero of the Yard instructed his children to go into the law, and they all did (both boys, and their sister Dorothy as well). Arthur’s obedience, though, was laced with insubordination, since he didn’t shy away from calling police evidence into question. In the case that recommended the barrister Peter Rawlinson to Wildeblood, the “towpath murders”, Rawlinson was junior counsel, and Arthur Prothero was crucial in persuading him to cross-examine the murder squad detective Herbert Hannam aggressively over two days, casting doubt on much of his evidence, a controversial procedure in those days. Even in a case where a bloodstained axe that had been found in the accused’s car went missing (a police constable had taken it home and was using it to chop wood). The accused, Alfred Charles Whiteway, was convicted and hanged, and this is unlikely to have been a miscarriage of justice, but Peter Wildeblood wanted a legal team that didn’t blindly assume police procedures were above board. Dishonest police dealing with gay men was a matter of course on the streets of London, and entrapment a constant risk for the unwary. It had already emerged that a date stamp in Montagu’s passport had been altered while it was in police possession, so as to make him seem a liar.

‘A man’s best friend is his solicitor’ … from left, Michael Pitt-Rivers, Lord Montagu and Peter Wildeblood leave court in 1954. Photograph: Keystone/Getty

To look at it from the other side, what was it that attracted Prothero to a case that most solicitors would regard as unsavoury, particularly as Wildeblood was resolved to announce his sexual orientation in court? It may have been one more defiance of his father’s values. Chief Inspector Prothero had been the only witness called in the prosecution of The Well of Loneliness in 1928. He testified that the very theme of Radclyffe Hall’s novel was offensive, and the magistrate ordered all copies of it destroyed. If he had wanted to dramatise a generational shift of attitude about same-sex relations, Arthur could hardly have done the job more clearly, or more publicly. This was a case that would make front-page news.

There were other shifts of attitude taking place, of the sort conventionally associated with the 1960s, as the last day of the trial showed. There was a delay before the convicted men were taken away, though they only understood the reason for it later. Wildeblood had been spat at by a stranger a few days before (“a middle-aged, tweedy person wearing a sensible felt hat”), in an echo of Wilde’s ordeal on the platform of Clapham Junction railway station, but on the day of sentencing the current of public feeling ran the other way. It was McNally and Reynolds who were jeered and barracked, by a crowd of perhaps two hundred, as they left the court. The small group of people, mainly women, who surrounded the car (an old Rolls-Royce) taking the new convicts away were conveying messages of support not condemnation – saying “keep smiling”, giving the thumbs-up and applauding.

The existence of public support for gay people was a new element of the Wildeblood case, and it features in his book even before the text begins, with the dedication (in capitals to make sure no one missed it) “TO MY MOTHER AND FATHER”. It’s not that homosexuals were always disowned by their families – support was always a possibility. It was making that support public that was new. It suggested that the shrouding corrosive fog of disgrace that had seemed a permanent feature of the British moral landscape was thinning, and might eventually blow away.

Against the Law agitated for civil rights for homosexuals, but the book is also an attack on conditions in the prison system, and after his release Wildeblood involved himself in the process of rehabilitating criminals, trying to break the pattern of their reoffending and returning to prison. His support wasn’t conditional on sharing an orientation. He understood that the privileged new idea of gay people not being a separate species brought obligations along with it.

In those days hardback and paperback publication were not smoothly co-ordinated, to the point where they count almost as separate events. That was certainly how it worked with the Penguin version of Against the Law. It was during Wildeblood’s prison term that the Woolfenden committee was set up to investigate the state of the law as it regarded homosexuality and prostitution, and to make recommendations for reform if need be. In fact his conviction along with his socially prominent co-defendants lent a strong impulse to the formation of such a committee, and he gave evidence to it. The paperback of Against the Law was published early in 1957, and the committee published its report later that year.

Wildeblood wanted his book to be widely available – so that it would reach people who needed to know they weren't alone

There was a stubborn assumption in some quarters that controversial material only became dangerous when widely distributed and made cheaply available. Pamela Hansford Johnson, for instance, in her book On Iniquity, subtitled “some personal reflections arising out of the Moors Murders trial” and published in the year that homosexuals finally received some civil recognition (1967), recalls the “little storm” she had raised, not long before, “by suggesting, in a letter to the Guardian, that it was not desirable for Krafft-Ebing [whose Psychopathia Sexualis was intended as a serious study] to be available in relatively cheap paperback edition on the bookstalls of English railway stations.” Class again. The idea was indirectly expressed in the Lady Chatterley trial in 1960 (Penguin Books the defendant) in the suggestion made to the jury that “you” wouldn’t want your wife or servants exposed to such a book – the implication being that “you” might not need protection, but others did.

Naturally enough Wildeblood wanted his book widely and cheaply available, since one of the points he made in it, by breaking down criminal convictions by social category, was that homosexuality cut across class lines. A cheap book available from station bookstalls would reach exactly those people who needed to know they weren’t alone.

George Weidenfeld, who had sold the rights to Penguin, was mortified that Weidenfeld & Nicolson was not credited as the original publishers in the paperback, especially as it was the first book Penguin had acquired from him, though his firm had been in operation since 1949 (the correspondence is part of the Penguin archive held at the University of Bristol). He described himself as “terribly distressed”, since he had assumed that such an acknowledgement was standard practice: “The prestige of the mention of one’s name in a Penguin book – a tribute to your reputation – is a very material point in favour of an arrangement with your house as distinct from other reprint houses.” There seems something barbed in that condescending phrase “reprint houses” after praise of Penguin’s reputation, as if he felt that the paperback publishers were claiming too much credit for a book originated by someone else.

The fog of disgrace … Against the Law. Photograph: Dean Rogers / BBC

Penguin, though, had the resources and willingness to turn the book into something of a campaign. At a party in November 1958 Sir Allen Lane, the founder of Penguin, suggested to Wildeblood that a copy of Against the Law should be sent to every sitting MP, since a debate was expected during the parliamentary session. The Penguin archive shows that the idea originated with Lane, just as he personally initiated the publication of Lady Chatterley’s Lover a year or so later. Wildeblood felt that the intervention would be most effective with a covering letter from Lane rather than himself. Lane agreed, and although the wording of the letter was submitted to Wildeblood for approval it didn’t originate with him. Signing your name 600 times or so may not seem much of a political act, now that mass mailshots can be generated with a click of a mouse, but anyone who thinks so should try it. In any case it was almost another decade before the law was changed.

Lane asked to see A Way of Life, Wildeblood’s sequel to Against the Law, and the first of his two novels, but didn’t acquire the rights. This is a shame in the case of A Way of Life, which richly opens out its personal material. The book describes a variety of gay lives, profiting not only from Wildeblood’s journalistic skills but his new status. As he puts it, “By going to prison I had become what statisticians call ‘socially mobile’, but to an extent of which no statistician had ever dreamed.” He befriends some entertaining young men on the make, such as the endlessly complaining Reggie: “They always want to take you to the ballet or something instead of paying hard cash. All you end up with is a lot of old long-playing records and your memories of Miss Fonteyn in Firebird, which doesn’t help much in your old age.” Wildeblood himself speaks up for the virtues of monogamy, feeling that one of the iniquities of the law was that it made it more dangerous for two men to live together than for the unattached to have shallow adventures, but he doesn’t invalidate conflicting testimony.

Shallow adventures … young men at La Caverne, a 1950s Soho bar and nightclub. Photograph: Joseph McKeown/Getty

He is also fascinated by heterosexual prostitution, inspired perhaps by the Woolfenden committee investigating that area. The effect, to be po-faced about it, is to destabilise the normality of straight behaviour, to the benefit of gay prestige, but his informant Pam is a wonderful character in her own right. She leaves a barrow boy who has a taste for bondage trussed up and suspended, with the maid keeping an eye on him while she catches up on the ironing. Meanwhile Pam nips out to the pub to see what else she can find. Next thing she knows, the barmaid is passing on an unusual message from home: “She says you’ve given her a chicken to cook and it’s all trussed up, but she thinks it’s a bad one or something because it’s turning quite black. . .” It’s a close call.

A Way of Life also contains a brief passage, paraphrasing someone else’s experience, in which Wildeblood allows himself to channel homosexual desire with a power startling for the period: “Gordon had never looked at a man’s body in this way before; he saw it for the first time as something to desire and fear, an instrument of tenderness and annihilation whose purposes he could not know.”

Judged by that standard, Wildeblood’s novels, The Main Chance (1957) and West End People (1958), must count as missed opportunities, though The Crooked Mile, a musical version of West End People, had a successful run. It’s not that the books aren’t lively or inventive. “It groped around inside itself with its slim mechanical hand, coughed, and placed the chosen record on its spinning navel” – anyone who can describe a jukebox in those terms knows what he’s about. There are bits of camp dialogue: “Don’t you ever read the papers!” / “Good heavens, no, dear. It’s bad enough having to write for them.” There’s social diversity of a certain restricted sort: “He stumbled, picked himself up and ran down a side-turning, followed by a hooting mob of espresso-bar skifflers, pacifists, pickpockets, evangelists and tarts.” But no gay men in evidence, though a writer of the period like Angus Wilson could introduce homosexual characters and themes into his novels without the world ending. Instead Wildeblood, particularly in West End People, takes a bizarre side turn into Damon Runyon territory, with lovable villains called Jug Ears Jones, Fingers, the Bishop, Bugsy, Mugsy and the Horse. It’s an odd choice for him to make, after refusing for so long to compromise or disappear. He puts everything into his novels except his bravery.

• Against the Law is on BBC2 later this month.