This is a study of the secret lives of politicians. Until 1967 (and for a further 13 years in Scotland and 15 in Northern Ireland), male homosexuality was a criminal offence in Britain. Even after legalisation, it would be many years before any ambitious politician dared own up to being gay or bisexual. Labour MP Chris Smith, in 1984, was the first.

Since then attitudes have transformed. A succession of recent reforms – equalisation of the age of consent, the legalisation of same-sex marriages, the right of gay couples to adopt – have been received with equanimity by the great British public. What was once deemed fatal to a career in politics is now of no relevance.

Michael Bloch has written a history of homosexuality and politics over the past 130 years. It cannot have been an easy book to write, since many of his subjects led double lives and took care to destroy evidence of their sexual proclivities. They were also helped by obliging biographers and editors of political diaries, such as Robert Rhodes James, who managed to omit from their works just about all suggestions of homosexuality. He has, however, managed to compile an entertaining, (though not prurient) and occasionally tendentious account of the sex lives of some of Britain’s most colourful and prominent politicians.

Gay rights around the world: the best and worst countries for equality Read more

What is surprising is that there were rather more secretly gay MPs than anyone imagined. According to the author, the Macmillan government, which balked at decriminalisation, “contained more closet queens than any other of the century”. Macmillan’s 1959-60 cabinet “included a homosexual or bisexual foreign secretary, chancellor of the exchequer, colonial secretary, health secretary and minister of labour, and was presided over by a prime minister who was rumoured to have been expelled from Eton for homosexuality”.

Inevitably, since most late 19th- and early 20th-century politicians were toffs, this is mainly a story of the upper classes, and a remarkable number were products of Eton. Although the late Victorian period was swept by a wave of puritanism, homosexuals flourished in the public schools, armed forces and in politics and, providing they were discreet and well-connected, they were left unmolested by those charged with enforcing the law. Prominent gay statesmen in the 1890s are said to have included the prime minister, Lord Rosebery, “Loulou” Harcourt (son of the chancellor), William Lygon (the seventh Earl Beauchamp), Liberals and Old Etonians all. Field Marshall Lord Kitchener, victor of Omdurman and later war minister, was said by a contemporary to have possessed “that failing acquired by most of the Egyptian officers, a taste for buggery”.

Labour's Tom Driberg spent a lot of time cruising public lavatories

Beauchamp, married with seven children, appears to have got away with leading a “hazardous, hedonistic life” for 40 years without encountering any serious trouble, all the while occupying some of the greatest positions in the land, including, ultimately, lord steward of the royal household. He came unstuck, however, in 1930, when his brother-in-law the Duke of Westminster launched a vendetta that led, at the insistence of King George V, to his having to disappear speedily into exile. In the best British tradition, the scandal was covered up, he was said to have gone abroad for health reasons, only resurfacing briefly towards the end of his life. Beauchamp was immortalised by Evelyn Waugh (a friend of the family) as Lord Marchmain in Brideshead Revisited.

Some of the behaviour documented here, whether the perpetrators were gay or heterosexual, would have been scandalous or distasteful in any era. Loulou Harcourt was said to have tried to seduce all four children (male and female) of a friend, colleague and fellow bisexual. Labour’s Tom Driberg spent a lot of time cruising public lavatories. Ian Harvey, a foreign office minister, was found in the undergrowth in St James’s park with a guardsman. Labour’s former secretary of state for Wales, Ron Davies, had his celebrated “moment of madness” on Clapham Common. Not forgetting the murky business surrounding Jeremy Thorpe and the alleged attempted assassination of his gay lover.

Some of what appears here is conjecture. The word “rumour” crops up frequently. Churchill may have been more at home in male company, but evidence for the proposition that he was bisexual is slender. Likewise, there is no evidence that Edward Heath ever had a sexual relationship with anyone. Edward Boyle is said to have “never showed any discernible romantic interest in anyone of either sex”. In which case, one might ask, what is he doing here?

The book is an entertainment, as much as a work of history. There are no great conclusions to be drawn. No evidence that sexuality ever seriously impacted on the conduct of public affairs. All that can be said is that many of those concerned might have led happier, more fulfilling, less hazardous lives had they lived in a more enlightened age.

Closet Queens is published by Little Brown (£25). Click here to order a copy for £20