On the night of Labour’s landslide election victory in 1945, a lady dining at the Savoy was heard to exclaim: “But it’s terrible: they have elected a Labour government, and the country will never stand for that.” It’s a remark that embodies all the stereotypes of the latter-day aristocrat: strident, out of touch, contemptuous of the lower orders, and imbued with an unshakeable sense of entitlement.

The telling word, of course, is “country”: it was doubtless unthinkable to the distinguished lady, as she peered over her fine silver cutlery at the gracious and orderly dining room, that the nation could belong to anyone else. Yet as Lawrence James shows in this erudite history, for centuries the aristocracy really was synonymous with “the country”. The more taxing question is how it managed to endure as a political force well into the 20th century, to the extent that Winston Churchill, a grandson of the Duke of Marlborough, presided over a wartime Cabinet that included six members of the House of Lords.

James’s conclusion, in short, is that the aristocracy’s survival is down to a political sleight-of-hand that sustained it through eight centuries of intermittent turmoil. It is summarised in a phrase by the Irish writer Thomas Moore, who likened the peerage to “a breakwater between the people and the throne, in a state of double responsibility – to liberty on one side, and authority, on the other”. Since the Middle Ages, whenever the monarchy has veered towards autocracy, the aristocracy has positioned itself as the guarantor of the people’s liberty. It’s hard to believe now, but when the House of Lords emerged as a political force in the 14th century it saw its role as defending the interests of the people against monarchs who were tempted to abuse their power.

James briskly takes us through this history, from the aristocracy’s arrival with the Norman kings in the 11th century, through the Peasants’ Revolt and the bitterly destructive Wars of the Roses in the 15th century. Though mainly focusing on England, James takes some time to examine the differing ways in which the Welsh, Scottish and Irish gentry were absorbed by their neighbour. Wales had the misfortune to be conquered in the 13th century, when its feudal institutions were easily absorbed by an expansionist monarchy. The Irish landowning class was levered out over centuries through a combination of papal decree, land grabs and Cromwell’s iron fist, to be replaced by English nobles, an early exercise in colonialism that had bitter consequences in time.

Scotland, writes James, proved a “tougher nut to crack”. Stung by the experience of Bannockburn, English kings thereafter preferred less direct approaches such as marriage – hence Henry VIII’s vigorous efforts to persuade Mary, Queen of Scots, to tie the knot with his son Edward. Eventually the Scots nobles’ resolve was ground down by half a century of civic unrest and sectarian tension, against which the security and prosperity of the nascent empire must have seemed a seductive prospect.

James’s technique is to take the Marxist notion of class as the driving force of history and turn it on its head, surveying the scene from the top of the pyramid. It allows him to compare the differing fortunes of aristocracies around Europe, particularly France, where the nobility tied its fate to that of an absolutist monarch and fell alongside him. By contrast, both the English Civil War and the Glorious Revolution of 1688, which brought William of Orange to the throne, saw the aristocracy defending the liberty of the nation against a king who refused to compromise his belief in his divine right to rule. James is particularly scornful of the subsequent Jacobite enterprise, which he characterises as a doomed attempt to impose autocratic rule in a kingdom that had no appetite for it, and dismisses the losing party at Culloden as “a feudal host of axe- and swordsmen who charged in the obsolete, heroic manner of the clan warrior”.

Such lapses into crude stereotype do James no favours as a social historian – elsewhere he derides “the tribal, Gaelic world of the Highlands with its culture of feasting, cattle rustling and clan feuds”. It’s a pity, since the aristocracy’s influence on society is his strongest suit. He is brilliant at dissecting the changing fashions of architecture as an expression of power, from indomitable mediaeval castles to magnificent Georgian mansions, through to the ostentatious nostalgia of the Victorian Gothic revival. Similarly, he makes a powerful case for the importance of the Game Laws and how the exclusive right to shoot rabbits and pheasants on their land became a red-line issue for the aristocracy. He has an aptitude for the literary flourish and caustic aside that plays well with his audience, though the overall impression of elegance is blighted by the kind of lax proofreading that will make some readers choke up brandy through their nostrils.

Inevitably perhaps, given such a broad-brush approach, there are some serious omissions. There is nothing at all about the Clearances, arguably the event that soured the relationship between landowners and tenants in Scotland more than any, nor about the establishment of crofting, which many lairds resisted tooth and nail, even though one of its aims was to ring-fence their ownership of vast swathes of the country. Clearance landlords did the maths and decided that sheep were a better class of tenant than people, but in the long term the policy was ruinous: sheep could not support their interests at the ballot box when universal suffrage came along, and many of the displaced people ended up in burgeoning industrial cities such as Glasgow, where their descendants formed the vanguard of the Labour movement.

Ultimately, what did for the aristocracy as a ruling class was the rise of alternatives to land ownership as a means of making money, and on this point James is hard to fault. He observes that between 1837 and 1911 nearly 500 families were ennobled, but more pertinently a third of all titles awarded in the last 25 years of that period went to commercial and industrial tycoons: Rothschilds, Northcliffes, Burtons and Guinnesses. The steady growth of non-titled property owners who qualified for the vote made the clamour for widening the franchise overwhelming, and electoral politics ruinously expensive at a time when land prices were falling. Incidentally, James is too forgiving of the rampant corruption that made democracy redundant in those areas of the country known as “pocket boroughs”, which were traded among the gentry like thoroughbred horses, as he is of other aristocratic vices, such as the late-Victorian fad for smashing hotel windows.

“The hereditary principle is woven into the public life of the nation”, declared the fourth Marquess of Salisbury in 1933, and though the upper classes serve a largely decorative function in the 21st century, the teeth of the aristocracy are still sunk deep into the British body politic. Take the reported exchange in the Westminster voting lobbies between the Tory MPs Tim Sainsbury, scion of the supermarket dynasty, and Nicholas Soames, a descendant of the Duke of ­Marlborough, when the latter was dressed in his hunting gear. “Going rat-catching, Nick?” asked Sainsbury, to which the noble Soames is said to have replied: “F*** off, you grocer. You don’t tell a gentleman how to dress on a Friday.”

What’s remarkable about this anecdote is that whenever it is told, it leaves the impression that somehow it was Sainsbury who spoke out of turn. The aristocracy may be in decline, but its fall is some way off.