The polymath Charles Arnold-Baker, who has died aged 90, was the author of The Companion to British History (1996), an encyclopedic work in the tradition of Samuel Johnson, and one of the most remarkable publishing ventures of recent years. Arnold-Baker single-handedly wrote every one of its thousands of pithy, erudite and sometimes eccentric entries, passing judgment on a vast array of historical figures, events and themes ranging from the Roman invasion, to the common law, to the limerick. The latter entry takes the form of its subject matter.

Though to all appearances an upper-middle-class Englishman, Arnold-Baker was born in Berlin during the last months of Kaiser Wilhelm II's reign. He was christened Wolfgang Charles Werner von Blumenthal, the second son of Baron Albrecht von Blumenthal, a professor at Giessen University and Wilhelmine Hainsworth, his English wife.

Wilhelmine, following her divorce from the baron, took Charles to England, where she married a solicitor, Percy Arnold-Baker. Charles was educated at Winchester and Magdalen College, Oxford, where he began reading philosophy, politics and economics, changed to law for a year and eventually took his degree in history.

The rise of the Nazis in the country of his birth perturbed him, as did Germany's subsequent moral collapse. Having become a British citizen, he joined the army as a private at the outbreak of the second world war and ended up a captain in the Royal East Kent regiment, "the Buffs". He served as a member of Churchill's bodyguard, dining frequently with the wartime premier, and was recruited by MI6 (where he met the "loathsome" Kim Philby), for whom he catalogued German spies before heading to Belgium to round them up. As a fluent speaker of German, he was sent to interrogate prisoners in Norway, following the German surrender in 1945.

After the war, he read for the bar and in 1948 was called to practise in shipping and parliamentary affairs. Frustrated by delays in payment, he sought a job with a regular income, in 1953 becoming secretary-general of the National Association of Local Councils, for which he became a passionate and influential spokesman. He was appointed OBE for his services to local government in 1966, and his book Local Council Administration (1975) remains a key reference work.

His career took another unexpected turn when he was appointed a lecturer in law and architecture (in which he had no formal training) at City University, London, having been interviewed for the position in a local pub. Around the same time, despite having never learned to drive, he became deputy traffic commissioner for the east of England.

Throughout, he was compiling his masterpiece, The Companion to British History. It was born of a chance meeting with an old schoolfriend in Soho who worked for Oxford University Press and remembered that Arnold-Baker had won a school history prize. OUP had recently published The Companion to English Literature and wanted to expand the series, so in 1960 they commissioned Arnold-Baker.

The Companion was compiled using primitive methods. Arnold-Baker would divide the pages of an exercise book into five columns and start writing down, at random, headings of subjects for which he would then write remarkably economical and often highly opinionated entries, which he worked on almost every evening for 25 years, getting by on four hours' sleep a night. He wrote out the whole of British history from 55BC, then chopped it up into bits and put it all into alphabetical order. It took more than 30 years to complete.

Arnold-Baker and OUP, following a series of misunderstandings and disagreements over the increasingly idiosyncratic nature of the work, parted company and the project lay dormant for four years, its entries crammed into eight boxes. At the prompting of his son Henry, he returned to the project, but was distressed that 4,000 entries had disappeared. He wrote them out again, always by hand, eventually ending up with 15,000 entries in all.

He offered the work to a number of other publishers but was rejected. When family members raised sufficient funds, it was self-published in 1996 under the imprint of Longcross Press. Routledge agreed to produce a little-amended second edition in 2002. The latest edition, the third, published independently last year by Loncross Denholm, is the definitive version. As Arnold-Baker recalled in his final interview, published in this month's History Today: "I decided to put in as many odd bits and pieces as might be interesting to somebody. I try to get as much in by means of the fewest number of words. It is extremely economical which makes it bloody hard work."

The Companion was brought to public prominence in 1997 by an admiring review by the Conservative commentator Simon Heffer, though Arnold-Baker was himself a keen Liberal. He founded and was chairman of the City of London Liberals (his wife, Fanny, was the secretary), and he was on friendly terms with the former party leader Jeremy Thorpe, who once told him: "When we have abolished the right of hereditary peers to sit in the House of Lords, I shall have myself made a duke." But he ceased to vote Liberal when the party supported the then-Labour minister Shirley Williams over the abolition of direct grants to grammar schools.

To the end, Arnold-Baker was sharp and engaging company, holding court in his Johnsonian garret in the Inner Temple, which he had occupied since 1942, in the process becoming senior barrister. In 1943 he married Edith Woods, always known as Fanny. His autobiography, For He is an Englishman: Memoirs of a Prussian Nobleman, was published in 2007. He is survived by Fanny, Henry and a daughter Katherine.

•Charles Arnold-Baker (Wolfgang Charles Werner von Blumenthal), lawyer, writer and public servant, born 25 June 1918; died 6 June 2009