Michael Gilbert, who has died aged 93, entertained a large public from 1947 until some two years before his death with a stream of novels in the broad genre of crime, always skilfully telling a story, invariably illuminating sharply aspects of British life and, on occasion, digging deep into the human psyche so as to point to an unwavering moral.

Out of inherent modesty, however, he liked to deny that he was making any attempt to be like those novelists who are seen as laying down moral maps - unlike some crime practitioners. Indeed, in commenting on his aims in the massive reference work, Twentieth Century Crime and Mystery Writers, he included a gentle rebuke to myself. In reviewing his The Night of the Twelfth (1976), I had praised him for introducing a grave note of that sort; what, he asked, "is a writer to do if he is not allowed to entertain?"

And entertain Gilbert did, not only with some 30 novels but with many short stories, as well as four stage plays, plays for radio and plays and serials for television. All this occurred while he was at Lincoln's Inn, where he worked as a solicitor and later partner. His clients ranged from the government of Bahrain to Raymond Chandler, with whom he had a lively correspondence.

How did he manage to do it all? By industry and application, of course, but also by taking advantage of the 50-minute morning train journey from his home in Kent to write some 500 words each day. This was an art he had learnt in wartime when, saving electricity as he felt was his duty, he took to reading for his law finals in the light provided by the Tube, three times round the Circle Line. The war, however, intervened before he was able to become articled as a solicitor.

Educated at Blundell's school in Devon and at London University, where he graduated in law in 1937, Gilbert served with the Royal Horse Artillery from 1939 to 1945. Mentioned in dispatches in 1943, he was taken prisoner in Africa and later transferred to Italy where, with two companions, he escaped in the confusion of the Italian surrender, later writing about his adventures in The Long Journey Home (1985). Curiously, both his companions, the travel writer Eric Newby and Tony Davies, also wrote of their experiences in the Apennines, both noting the very painful carbuncle that had made Gilbert's life even harder to bear. One, however, situated the sore in his armpit, the other on his behind. In 1947 he married Roberta Marsden and joined Trower Still & Keeling, of which he was a partner from 1952 to 1983.

Gilbert's time as a PoW prompted Death In Captivity (1952), surely the only whodunnit set in a prisoner-of-war camp. But he had been quick to embark on his long career as a crime writer with Close Quarters (1947), a book that took advantage of a short career as a prewar schoolmaster. They Never Looked Inside followed in 1948 and The Doors Open in 1949.

It was in 1950 that he produced a story rightly hailed as a classic of the genre, Smallbone Deceased, rich with everyday details of a law practice, both good and naughty, dancing too with pawky humour; at the same time it sets a puzzle to please the most exigent of readers and provides, surely, the most intriguing place ever for the body to be found - in a slightly oversized deed box.

In 1965 we were given - I use the expression deliberately, as Gilbert's books were presents indeed to his readers - The Crack in the Teacup, a properly dry title for a book set in the hitherto hardly used world of dull-seeming municipal government. In it he made vivid fiction of law reports about everyday corruption. His calm emphasis here on the sometimes forgotten need to see justice done shows his unyielding belief in its importance.

The same quality emerges in Young Petrella (1988) and the many short stories Gilbert wrote about a Metropolitan police officer making his way up the ranks, an accurate and incredible account of life in the police, something by no means always demonstrated in the popular, violence imbued subgenre of the police procedural. His attitude underlines the plain honesty he brought to every aspect of his writing; a quality illustrated by his often expressed detestation of adverts, which he saw as no more than an attempt to gild the lily.

It is a quality equally to be seen in Gilbert's forays into espionage fiction with the stories of the British agents, Mr Calder and Mr Behrens, a telling subtlety in those nomenclature titles. The tales of their exploits show, too, another aspect of their creator - his unflinching look at the ugly and unpleasant in everyday life, whether in the touched in use of the cane in The Night of the Twelfth, set in a 1930s prep school, which is also a study of the vilest, sadistic cruelty brought to a proper end, or equally in the necessary ruthlessness Calder and Behrens occasionally show in their work. No wonder Game without Rules (1967), his short story collection about the pair, was ranked by a New York Times critic as second only in its field to Somerset Maugham's Ashenden Tales. In 1986 he edited The Oxford Book of Legal Anecdotes. His last novel was Over and Out (1998).

Gilbert's industry and standards of service were also to the fore in his public life. Fifty years ago he was a founder member of the Crime Writers' Association, and his legal expertise was always at the disposal of the Detection Club, to which he was elected in 1949. He became, in 1988, a grandmaster of the Mystery Writers of America and in 1994 he was awarded the association's diamond dagger for a lifetime's achievement. In 1980 he was made a CBE.

He is survived by his wife Mary, their two sons and five daughters, among them the novelist Harriet Gilbert.

· Michael Francis Gilbert, crime writer and solicitor, born July 17 1912; died February 8 2006.