PD James, latterly Lady James of Holland Park, who has died aged 94, was the grande dame of the British crime novel.
She was a link with the golden age of detective writing that flourished between the wars, the successor to Agatha Christie, Dorothy L Sayers and Margery Allingham. After Christie's death, she was called the new Queen of Crime, a title she did not at all mind.
Yet Phyllis James had not started writing until her 40s and said she only wrote a whodunnit as practice for a serious novel. Later on, though, she never fretted about being locked into crime writing.
She was born in Oxford, daughter of Sidney, a tax inspector, and Dorothy (née Hone). It was, she said, an unhappy home.
The family moved to Cambridgeshire and Phyllis attended Cambridge girls high school. She did well, but her father did not approve of education for girls and so she did not go to university.
In London in 1941 married Connor White, a doctor, but he returned from the war suffering from a serious psychiatric disorder. It became apparent to her that she would have to support him and their two daughters, so she joined the civil service as a health administrator.
When she turned 40, she realised she must do something about writing a novel. She thought perhaps it was already too late, but started setting the alarm clock for 5am, rising in the dark to work on the book before the serious business of her day began. Country house murders This first novel was Cover Her Face (1962), which harked back to the cosy murders of the golden age, set in a country house with a body in a locked room and a cast including the vicar and a genial country doctor.
It also featured Adam Dalgliesh, the poet-policeman, who seemed a little old-fashioned too, rather intellectual and upper class. On the verge of the 1960s, she was perhaps lucky to get such a book published.
James followed up her initial success with A Mind to Murder and Unnatural Causes and seemed happy to remain in detective fiction, although the critics often remarked how literary she was. Kingsley Amis called her "Iris Murdoch with murder".
Her books always contained at least one religious character, a sign of her personal devotion to Anglicanism. This gave rise to much discussion in her stories about the nature of good and evil, with Dalgliesh, the son of a vicar, often leading the way.
Many of her books were adapted for television, with Roy Marsden playing Dalgliesh in the ITV versions. He was perfect in the part, but the adaptations never seemed true to the books, perhaps because on the page Dalgliesh is such a shadowy figure, often unseen for whole chapters at a time.
James’s full-time occupation as a civil servant provided her with material. She worked successively in the health service, then the home office, the forensic science service and the criminal policy department, retiring in 1979. There were few crime writers as well informed about their subject.
She was made a doctor of letters by more than half a dozen universities, a fellow of the Royal Society of Literature and the Royal Society of Arts, and president of the Society of Authors. Tory peer She served as a governor of the BBC and as a magistrate in Middlesex and London, a member of the board of the British Council and chair of the literary advisory panel of the Arts Council.
In 1983 she was appointed an OBE and in 1991, made a life peer as Lady James of Holland Park. She sat on the crossbenches for a time, but then moved to the Conservative side.
James published her autobiography, Time to Be in Earnest, in 1999. She kept writing, bringing back Dalgliesh in Death In Holy Orders (2001). In 2003 she published another crime novel with a setting straight out of the murder mystery golden age, The Murder Room.
The Lighthouse, in 2005, set in Agatha Christie territory, on an island off the coast of Cornwall, features Dalgliesh solving a murder at an upmarket rest home.
In 2011 she entered Jane Austen country with Death Comes to Pemberley, a whodunnit set in 1803, six years after the events of Pride and Prejudice. It was successfully televised in December 2013, with Antonia Fraser calling it "a Christmas feast".
Well into her 90s, James continued to appear at literary festivals. She was soft-spoken but could be hard-hitting. In 2009, when guest-editing the Today programme on Radio 4, she reduced the BBC director-general to stutters when she accused him of dumbing down output and overpaying executives.
She once said she possessed what Graham Greene called "the splinter of ice in the heart".
“If I had a friend in distress I would have no hesitation in putting my arms around her to comfort her,” James said, “but part of me would be observing the scene.”
Her husband died in 1964. James is survived by their daughters, Clare and Jane, five grandchildren and eight great-grandchildren.